ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Random jump cuts to audio

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Anna Hahn
Random jump cuts to audio
on Dec 30, 2018 at 9:49:17 pm
Last Edited By Anna Hahn on Dec 30, 2018 at 9:50:06 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);


Return to posts index

Kalleheikki Kannisto
Re: Random jump cuts to audio
on Dec 31, 2018 at 12:19:53 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 http://www.motionscript.com/design-guide/marker-sync.html

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]