Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is it possible to control animetion by sound levels?

  • Is it possible to control animetion by sound levels?

    Posted by Adi Arusi on July 12, 2016 at 9:30 am

    hey all
    Is it possible to control animetion by sound levels?
    for example:
    I want the animation to start after the presenter stops talking…
    But the presenter footage changes every day and the duration of the footage changes also…
    I want to automate this process

    Any ideas?

    Thanks,
    Adi

    Adi Arusi replied 9 years, 9 months ago 3 Members · 4 Replies
  • 4 Replies
  • Kevin Camp

    July 15, 2016 at 6:48 pm

    yes, you could trigger the animation when the audio levels drop bellow a set level, you’d need to first cover the audio levels to key frames (select footage layer, then animation>keyframe assistant>cover audio to key frames), then point your expression to the audio keyframes.

    However, the animation might trigger at a short pause between sentences, so ultimately you’d be manually setting up many of the comps, and you’ll also have to manually convert the audio to keyframes for each new footage layer… so not exactly automated.

    you could use the layer markers that you have to set the timing of the animation, but if you only have a few keyframes, to move, then it’s about the same amount of work to slide those.

    the best option I can think of would be to set the animation to trigger based on the duration of the footage layer, but you’d still likely need to manually trim the footage layer.

    so say you trim the end of each footage layer to end one second after they have stopped talking. you could set up an expression like this on the position property to trigger the position animation to start one second prior to the end of the footage layer:
    target = thisComp.layer("presenteropen");
    backtime = 1; // value in seconds
    animStart = target.outPoint - backtime;
    if (time > animStart) valueAtTime(time - animStart + key(1).time) else key(1).value;

    you can set the backtime value as needed — say you want to trim the footage layer to 1.5 seconds after they stop talking, then you’d set backtime to 1.5

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Adi Arusi

    July 16, 2016 at 5:32 pm

    hey kevin
    thanks u very much about your quick response…
    i have trayd this expression and it work very good , it solved a lot of problems for me…

    you said that i could trigger animation to start when the audio levels drop below a set level.
    let’s say i want the expression recognizing 5 seconds of “0” value (audio level) of layer “presenteropen” – go back 2 seconds and then start the animation…
    this is possible with expression?

    thank you very much
    adi

  • Kalleheikki Kannisto

    July 25, 2016 at 9:27 am

    Here’s my take, applied to time remap. You’ll still need to convert the audio to keyframes, but this looks backwards from the end of the audio until the sound comes in and sets the time remap offset of the animation accordingly. Meaning, you’d time remap the animation and apply this expression to the time remapping value.

    endtime = thisComp.layer("Audio Amplitude").outPoint; // where the audio amplitude layer ends
    range = 5; // maximum amount of seconds to look backwards
    anim_start = endtime; // initial value for animation start time
    framedur = thisComp.frameDuration;
    n = endtime;
    while (n > endtime - range) {
    vol = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider").valueAtTime(n); //audio volume at this point in time
    if (vol > 0) {anim_start = n; break} // when volume comes up, set animation start point and exit loop
    else {n = n-framedur}
    }
    time - anim_start

    You can add an offset value (in seconds) on the last line to change the starting point earlier or later. If the audio isn’t totally clean (doesn’t go to 0 when ended) you can up the value in the if statement to something higher for a threshold value below which it is considered silent.

  • Adi Arusi

    July 26, 2016 at 10:42 am

    thanks Kalle,
    it’s amazing… exactly what i needed

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