Activity › Forums › Adobe After Effects Expressions › Queue Video or Animation Based on Audio
-
Queue Video or Animation Based on Audio
Posted by Kurt Barken on December 4, 2015 at 11:25 pmDoes anybody know how to replay the same animation based on audio? Specifically, I wanted this animation: https://imgur.com/W3qezgc that I created in AE, to replay every time there is a bass hit in the audio file. Thanks in advance for any help!
Dan Ebberts replied 10 years, 8 months ago 2 Members · 4 Replies -
4 Replies
-
Dan Ebberts
December 4, 2015 at 11:38 pmThe basic idea is explained here:
https://www.motionscript.com/design-guide/audio-trigger.html
Assuming you converted your audio to keyframes and your animation is in a time remapped layer, this time remap expression should be close to what you need:
threshold = 10.0;
audioLev = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
above = false;
frame = Math.round(time / thisComp.frameDuration);
while (true){
t = frame * thisComp.frameDuration;
if (above){
if (audioLev.valueAtTime(t) < threshold){
frame++;
break;
}
}else if (audioLev.valueAtTime(t) >= threshold){
above = true;
}
if (frame == 0){
break;
}
frame--
}
if (! above){
t = 0;
}else{
t = time - frame * thisComp.frameDuration;
}
t
Dan
-
Kurt Barken
December 5, 2015 at 12:01 amYour expression worked good, but is there any way to accomplish this through Trapcode Sound Keys?
-
Dan Ebberts
December 5, 2015 at 12:14 amDo you mean using just Sound Keys? I don’t think so.
If you mean using the expression with Sound Keys, I think all you would have to do is change the second line to something like this:
audioLev = thisComp.layer(“Black Solid 1”).effect(“Sound Keys”)(“Output 1”);
and maybe adjust the threshold value in the first line, depending on how you have your Sound Keys output set up.
Dan
Reply to this Discussion! Login or Sign Up