Copy link to clipboard
Copied
Hi, I'm trying to use sync the speed of the video to the bass of a song. I have all the keyframes from the audio where the bass beats are on by having slider values = linear(value, minimumAmplitude, maximumAmplitude, slowSpeed, fastSpeed) from the Audio Amplitude object. With each keyframe associated with a speed, I want to bring the keyframes into the time remapping of speed using a pick whip(i.e. timeremapping.speed = the current slider value). How would I approach this?
Copy link to clipboard
Copied
Let me clear a couple of things up. Audio Amplitude gives you the audio level only. If you want to emphasize the bass then you need to run an EQ on the audio track and strip out all the other frequencies. The easiest way to do this staying in After Effects is to duplicate your audio layer, apply Low Pass or Parametric EQ and emphasize the bass and minimize the high frequencies then Run Audio to Keyframes. The Audio tools in After Effects are extremely limited so you will not have a lot of control. To do the best job you need to either process the audio in Audition or purchase Trapcode Sound Keys. This is the only way you can take animation information from anything but audio levels. The reason for the duplicate is so you can delete the layer after you generate the keyframes so the highly modified audio will not end up in the final mix. If you purchase sound keys you don't need to make a duplicate or fiddle with the EQ.
The second part of your problem is a lot more complicated. Time Remapping works on time not speed of playback. Audio levels are values that go up and down so if you just tie time remapping to the Audio Amplitude or Sound Keys keyframes the video will play forward as the level increases then run in reverse as the level decreases. If you want to slow down and speed up you need to create an accumulator that adds the value of each frame to the value of the next, then figure out what the grand total will be and adjust the linear method values so that the video will not end before the audio does. That's a lot more complicated.
The first step would be to just build an accumulator that adds the value of each keyframe to the previous keyframe. The only problem is that the solution is recursive. After about 20 seconds you will notice an exponential increase in the time it takes to calculate the next frame.
Dan Ebberts has a great page on this subject. His expression only needs a little modification to make sure that you don't run out of the movie. You'll find the page here: https://www.motionscript.com/articles/speed-control.html
This is the modified expression assuming that the audio movie and the audio track are 30 seconds long:
spd = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
mult = .5;
n = spd.numKeys;
if (n > 0 && spd.key(1).time < time){
accum = spd.key(1).value*(spd.key(1).time - inPoint);
for (i = 2; i <= n; i++){
if (spd.key(i).time > time) break;
k1 = spd.key(i-1);
k2 = spd.key(i);
accum += (k1.value + k2.value)*(k2.time - k1.time)/2;
}
accum += (spd.value + spd.key(i-1).value)*(time - spd.key(i-1).time)/2;
}else{
accum = spd.value*(time - inPoint);
}
t = value + accum*mult;
linear(t, 0, 239, 0, 30)
When I applied the expression without the linear method at the end I got a value of 239.96857938475 for the last frame of the audio amplitude layer and the comp. I rounded that to 239. The second set of numbers is in seconds because when you use an expression for Time Remapping the delivered value is always in seconds. You don't have to change the expression if you change the frame rate of the comp.
I hope this helps. If you have any other questions or want time remapping to do something else let us know.
Copy link to clipboard
Copied
Wow, I wasn't expecting such a detailed response! Thank you for the advice/code! I'll try to implement it into After Effects and see if it works.
Copy link to clipboard
Copied
Keeping in mind what Rick has said, you may want to try Effect>Time>Timewarp which has a speed prop. Take note that your footage should be sufficiently long. If it isn't, you will need to Interepret Footage and either change the framerate and/or set an appropriate number of loops. HTH
Find more inspiration, events, and resources on the new Adobe Community
Explore Now