Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › video speed connected to audio amplitude

  • video speed connected to audio amplitude

    Posted by Marcush. on July 16, 2007 at 10:58 pm

    Hi,

    this might sound weird, and I am certainly not very comfortable with Javascript, but I try to do this for a couple of hours now with no success:

    I want a video to play faster whenever the audio of another layer gets louder. I tried this:
    (Get_Frame is a Sapphire FX, which shows a specific frame from a clip. This expression is connected to that very Get_Frame instance.)

    var1 = effect(“S_GetFrame”)(“Get Frame”);
    a = thisComp.layer(“Audioamplitude”).effect(“”Both Channels”)(“Slider”);
    b = timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false)/10;
    var2 = a + b;
    if (var2 > var1) {var1 = var2};
    var1;

    What I want here is the video not to go back in time, but only advance in time. The “/10” sets the slowest speed to 3fps. The whole problem here is that it still goes back in time a couple of frames (depending on the audio). The main issue would be that the value for Get_Frame is only supposed to go up over time, and not down.

    My knowledge of Javascript is almost non existing, and to even get to that point took a while. Any help is greatly appreciated!

    Cheers

    Marcus

    Marcush. replied 19 years, 2 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    July 17, 2007 at 1:07 pm

    The easiest (and best) way to do this is with Trapcode’s Sound Keys plugin and a time remapping expression.

    Other than that, you’ll need to modify your expressions so that it loops through all previous frames and accumulates the audio amplitude at each frame. Then you would multiply the total by some scale factor, add that to the current time, and convert to frame number. That will cause the value to always keep increasing, and increase faster in response to louder audio.

    Dan

  • Marcush.

    July 17, 2007 at 1:17 pm

    Hello Dan,

    thank you so much for this reply. The picture does become a little clearer now.

    What I do not understand though: Why is what I did not working? Is there no easy way to avoid a value to decrease, and to only allow it to increase over time (reading the current state and not letting it go below it…)? To me that does sound simple. But then again, I am not familar with the expressions world at all.

  • Dan Ebberts

    July 17, 2007 at 1:54 pm

    The problem is that expressions have no memory. No information is passed from one frame to the next, so an expression has no way of knowing if its value is increasing or decreasing.

    What you have to do is loop frame by frame from time zero to the current frame, and recalculate the expression at each frame, accumulating the results as you go. Cumbersome, but possible.

    Dan

  • Marcush.

    July 23, 2007 at 12:01 pm

    Oh, I was offline for a week – sorry.

    Dan, thanks again for your help. I decided to go with my initial result, which grew on me.

    Have a nice week!

    Marcus

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