-
Link frame values to audio amplitude
I’m animating a series of lights that must respond to the background audio. So I’ve set up the animated lights in a sub-comp, each frame corresponding to one of 4 light levels. Then in my main comp I’ve converted audio to keyframes. I’ve activated Time Remap on my Lights comp and put this expression:
levels = Math.round(thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider"));
if ( levels <= 5 ) { 0 };
if ( levels > 5 && levels <= 10 ) { 1 };
if ( levels > 10 && levels <= 15 ) { 2 };
if ( levels > 15 && levels <= 20 ) { 3 };However, when I run my animation, whenever the level is 5 or less frame 0 is shown, as it should, but for everything else frame 3 is shown…
I’m sure I’m missing out something VERY basic here, but as it’s late at night I’m afraid no matter what I try I can’t fix this that should be rather straightforward.
<font face=”inherit”>I’ve tried making the Lights comp 20 frames long and distributing the single frames along those 20 frames, then simply linking the Time Remap to the Slider… same issue: once it goes over 5 it gets stuck at 20 until the next time it goes back below 5. </font>
<font face=”inherit”>I’ve even tried simply copying the Audio Amplitude slider keyframes and </font>pasting them onto the Time Remap with the exact same result.
<font face=”inherit”>In all cases I’ve tried both </font>rounding<font face=”inherit”> the numbers </font>amplitude<font face=”inherit”> numbers and leaving them as they are.</font>
<font face=”inherit”>I’m thinking it’s either a bug or the issue here is Time Remap. I know TR doesn’t play well with others, and as I experience every </font>other<font face=”inherit”> time when I want to use the LoopOut expression, or when sub-comps hace different animated layers TR is a real pain to work with, producing somehow overlapping frames, and out-ouf-sync layer animations.</font>
P.S. As this animation will in the future be used to react to different audios, is there any easier way of doing this that doesn’t involve converting audio to keyframes, which is rather a “manual” thing; I would like to have a template comp where I could swap out the audio every time and the animation updates through the expression, of course.
Thanks in advance!