Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Smooth animation based on “convert audio to keyframes”??

  • Smooth animation based on “convert audio to keyframes”??

    Posted by Anna Werner on May 21, 2013 at 10:43 am

    Hello everyone, I’m new here and not really an AE profession, but I’m stucked with a task that I just can’t figure out (google research for hours didnt help).

    I wanna create a ball that bounces to some music and changes the color based on the music, too.
    So far I understand the “Convert Audio to keyframes” thing and my ball has the following expression codes for position:

    temp = thisComp.layer(“Audio Amplitude”).effect(“Left Channel”)(“Slider”);
    [0+1500, -temp*10+800];

    and this one for the Hue of the Color effect

    thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”)

    It both works, but my problem is that i need a much smoother animation. Unfortunatly i can not smooth out the keyframes of the Audio Amplitude Layer cause that one needs to remain easy replaceble.
    So i was hoping that i could either somehow add a “smooth” into my expression code, or if there was a way to tell the expressions to only use every – lets say – 5th keyframe (or average of the next 5 keyframes).

    please help!

    Xavier Gomez replied 13 years ago 2 Members · 1 Reply
  • 1 Reply
  • Xavier Gomez

    May 21, 2013 at 7:38 pm

    There is a smooth expression, it is:
    smooth(width = 5*thisComp.frameDuration, samples = 5, t = time + 2*thisComp.frameDuration);

    You can use this expression in the audio amplitude (“Both Channels”).

    ==> link (towards the bottom of the page).
    I’m not sure what the parameter t exactly is, probably the center of the sampling interval. In that case, if you want to sample over the next 5 frames, use the expression above. But if you want to take into account values before and after the current time, just leave the default (t=time) or omit it. Then the expression takes “samples” samples over a width of “width” seconds around t and returns the average, but i’m also not sure if it is a weighted average or flat.

    You might be disappointed by what it does though. The smooth expression is fine, but maybe not what you are after for your animation.

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