Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Incrementing position of a layer using Trapcode Sound Keys

  • Incrementing position of a layer using Trapcode Sound Keys

    Posted by James Bazza on January 6, 2012 at 4:52 pm

    Hi there,

    Im trying to use the result of an output of sound keys to incrementally move the position of a layer..

    This is what I have tried, I cannot get the value to continually increment

    Thanks in advance for any help!

    SK = thisComp.layer("Soundkeys").effect("Sound Keys")("Output 1").valueAtTime(time+0.1)
    xPos = value[0] ;
    yPos = value[1] ;
    if (SK > 80){
    [xPos +20, yPos];
    }else{ [xPos , yPos ] ; }

    James Bazza replied 14 years, 8 months ago 3 Members · 5 Replies
  • 5 Replies
  • Kevin Camp

    January 6, 2012 at 5:25 pm

    i can’t experiment with this now, but i think you should be able to incorporate dan’s beat counter expression:

    https://www.motionscript.com/design-guide/audio-count.html

    the beat counter expression is the second one on that page.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Dan Ebberts

    January 6, 2012 at 6:34 pm

    Another possibility is to set the Sound Keys Range Falloff control to “None (integrate)”. This causes the output value to continually increase in response to the audio.

    Dan

  • James Bazza

    January 8, 2012 at 10:20 am

    thanks for the replies…

    Ok I tried using a while loop but am still stumped… I cant get the position to keep on incrementing

    SK = thisComp.layer("Soundkeys").effect("Sound Keys")("Output 1").valueAtTime(time+0.1);
    xPos = value[0] ;
    yPos = value[1] ;
    frame = Math.round(time / thisComp.frameDuration);

    while (frame >= 0){
    t = frame * thisComp.frameDuration;
    if (SK > 80){
    xPos = xPos+20;

    }else {
    xPos = xPos;
    }
    frame--
    }

    [xPos, yPos]

  • Dan Ebberts

    January 8, 2012 at 4:39 pm

    Try this:


    SK = thisComp.layer("Soundkeys").effect("Sound Keys")("Output 1");
    x = 0;

    for (f = timeToFrames(time); f >= 0; f--){
    t = framesToTime(f);
    if (SK.valueAtTime(t) > 80) x += 20;
    }

    value + [x,0]

    Dan

  • James Bazza

    January 8, 2012 at 5:08 pm

    ahh!! thanks so much, appreciate it. I see the mistakes I was making

    Cheers!

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