Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Changing audio levels dependence if there’s another video playing on top of it?

  • Changing audio levels dependence if there’s another video playing on top of it?

    Posted by Eliezer Cisner on August 7, 2012 at 6:45 pm

    I’ll try to make this question as clear as possible, if I’m not clear enough, please don’t hesitate to ask me, and I’ll try my best to rephrase:

    I have multiple video layers in my comp, and over them I have multiple short overlying layers (all named “Bumper n” that are supposed to play from time to time while the the underlying videos continue playing. The underlying video volumes need to get a bit softer every time the overlying videos play. Is there any expression that can tell the underlying videos to play softer every time there’s an overlying video layer?

    Sorry if I’m not clear enough.

    Eliezer Cisner replied 13 years, 12 months ago 2 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    August 7, 2012 at 7:25 pm

    This should drop the auido 12db if there’s an active layer with audio above it in the layer stack:


    attenuate = false;
    for (i = 1; i < index; i++){
    if (thisComp.layer(i).audioActive){
    attenuate = true;
    break;
    }
    }
    attenuate ? value - [12,12] : value

    Dan

  • Eliezer Cisner

    August 7, 2012 at 7:36 pm

    Wow, wow, wow! Simply genius! I almost gave up even before posting it, and the answer came so fast! No words, Dan, no words!

    Thanks a billion!

    P.S. Is it possible to have the audio transition gradually to its lower volume?

  • Dan Ebberts

    August 7, 2012 at 8:23 pm

    Something like this:


    ramp = .25;
    db = [12,12];
    attenuate = false;
    for (i = 1; i < index; i++){
    if (thisComp.layer(i).audioActive){
    attenuate = true;
    break;
    }
    }
    if (attenuate){
    L = thisComp.layer(i);
    if (time < (L.inPoint+L.outPoint)/2)
    linear(time,L.inPoint,L.inPoint+ramp,value,value-db)
    else
    linear(time,L.outPoint-ramp,L.outPoint,value-db,value);
    }else
    value

    ramp sets the duration of the fade time (in seconds).

    Dan

  • Eliezer Cisner

    August 7, 2012 at 8:39 pm

    Amazing! Thanks, Dan!

  • Eliezer Cisner

    August 7, 2012 at 8:44 pm

    I hate to nag, but I hope you don’t mind if I add another query:

    I’d like, if possible, to have the audio ramp back up a bit earlier, approximately two seconds before the end of the overlying layer (so the underlying audio is back to normal when the overlying video is complete).

    Thank you and sorry…

  • Dan Ebberts

    August 7, 2012 at 11:22 pm

    This should do it:


    ramp = .25;
    db = [12,12];
    out = 2;
    attenuate = false;
    for (i = 1; i < index; i++){
    if (thisComp.layer(i).audioActive){
    attenuate = true;
    break;
    }
    }
    if (attenuate){
    L = thisComp.layer(i);
    if (time < (L.inPoint+L.outPoint)/2)
    linear(time,L.inPoint,L.inPoint+ramp,value,value-db)
    else
    linear(time,L.outPoint-ramp-out,L.outPoint-out,value-db,value);
    }else
    value

    Dan

  • Eliezer Cisner

    August 8, 2012 at 2:56 pm

    Dan Ebberts, a genius in our midst.

    Thanks!

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