Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random jump cuts to audio

  • Random jump cuts to audio

    Posted by Anna Hahn on December 30, 2018 at 9:49 pm

    Hello

    I am currently working with a time remapping script that makes jump cuts to a random location within a clip every .44 seconds

    Is there a way to modify the expression pasted below to make it so the jump cuts occur corresponding to changes in an audio track or keyframes generated from an audio track? In other words, every time the audio level jumps above a certain threshold I would like to jump cut to a random location within the clip

    Any tips would be infiny appreciated

    Thanks so much!!

    Anna

    segDur = .44;// duration of each "segment" of random time
    minVal = inPoint;
    maxVal = outPoint - segDur;

    seed = Math.floor(time/segDur);
    segStart = seed*segDur;
    seedRandom(seed,true);
    startVal = random(minVal,maxVal);
    endVal = startVal + segDur;
    linear(time,segStart,segStart + segDur, startVal, endVal);

    Kalleheikki Kannisto replied 7 years, 4 months ago 2 Members · 1 Reply
  • 1 Reply
  • Kalleheikki Kannisto

    December 31, 2018 at 12:19 pm

    I wouldn’t recommend doing this purely through expressions. If you think the current expression is slow, you would not like the result, and likely it would be impossible to use the expression for footage longer than a minute or so. Expressions have no memory, so the expression would have to look through all previous frames for the audio levels and calculate the result newly for each frame. By the time you get to the one-minute mark, the expression would have to check all 1500 frames backwards, etc.
    A better, but somewhat labor-intensive approach would be to insert markers manually wherever you want the scene to change, based on the audio waveform. Then you can use the number of markers as random seed.

    This expression borrowed from Dan’s MotionScript site gives the last marker number:

    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time){
    n--;
    }
    }

    If you insert markers and add this line to the expression plus change the random seed line to
    seed = n;
    you should get a different section from the footage every time there is a marker.

    More information on triggering animations with markers at https://www.motionscript.com/design-guide/marker-sync.html

    Kalleheikki Kannisto
    Senior Graphic Designer

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy