Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Audio Expression start time delayed

  • Audio Expression start time delayed

    Posted by James Quetant on February 21, 2014 at 6:59 am

    So I found this expression by Dan that makes audio drive only the y position of a layer, which is exactly what I want but how do I control when this expression begins? It starts at a later time than I want it to & I want it to start sooner. Below is the expression.

    multiplier = -5;
    audio = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
    value + [0,audio*multiplier]

    James Quetant replied 12 years, 2 months ago 3 Members · 11 Replies
  • 11 Replies
  • George Goodman

    February 21, 2014 at 3:26 pm

    There’s nothing about timing in that expression. The only reason it would start later is if the layer is moved to a later time than you want or if the value of the audio *(-5) is giving you a y value that doesn’t move the layer. Try changing your multiplier to something else and see if that fixes it.

    “|_ (°_0) _|”

    Sincerely,

    George

  • James Quetant

    February 21, 2014 at 6:24 pm

    The multiplier only directs the amount of movement the y position will have. I’m asking what I would need to do in order to get it to start when I want it to, or sooner rather than later. The multiplier will not do that.

  • George Goodman

    February 21, 2014 at 6:54 pm

    Right I understand that, but if your multiplier is -5 and your value of the slider at the time you want it to start is 1, you’re only going to see a change of -5 which may not be enough for you to notice. This is why I told you to change your multiplier. If you make it something large like 100 or 200 you should see a change even if that value is low. Then you would know that it was just a matter of the slider value.

    Your expression doesn’t indicate a start or end time, which means it is always active. Either you don’t have a value for your audio where you want it to start, or its too low. The expression is correct.

    “|_ (°_0) _|”

    Sincerely,

    George

  • Dan Ebberts

    February 21, 2014 at 7:15 pm

    You might be looking for something like this (not tested, but should be close):


    tStart = 5; // start at 5 seconds
    t = time - tStart;
    if (t > 0){
    multiplier = -5;
    audio = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider").valueAtTime(t);
    value + [0,audio*multiplier]
    }else
    value

  • James Quetant

    February 22, 2014 at 12:27 am

    ok, thank you! the audio does actually FADE in & I want the action to happen right away, so I think I’m going to start with that.
    I appreciate the clarification also.

  • James Quetant

    February 22, 2014 at 1:38 am

    it’s saying expression result must be of dimension 2 not 1. Expression disabled.

  • Dan Ebberts

    February 22, 2014 at 2:09 am

    Hmmm… It works for me. You do have it applied to the position property, correct?

    Also, I think I got the start time backwards. If you wanted the motion to start sooner you would do something like this:

    tStart = -1;

  • James Quetant

    February 22, 2014 at 2:18 am

    yea, it’s still doing the same thing. here’s a screen shot of the expression

  • Dan Ebberts

    February 22, 2014 at 2:29 am

    Ah, you probably need to reformat it with carriage returns so that it looks like this after you paste it in:


    tStart = -1; // start at -1 seconds
    t = time - tStart;
    if (t > 0){
    multiplier = -5;
    audio = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider").valueAtTime(t);
    value + [0,audio*multiplier] }
    else
    value

  • James Quetant

    February 22, 2014 at 3:07 am

    This works perfectly!! Thank you kindly Dan I greatly appreciate it! I have another question for you if you don’t mind. I have a double bass instrument I’d like to have vibrate to audio.
    I was on your website that had the string vibration expression but it wasn’t to audio for one & when I tried it anyway it gave a weird jerky motion that was all over the place.

Page 1 of 2

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