Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Sound Keys – More Randomness?

  • Sound Keys – More Randomness?

    Posted by Fitbikeco88 on February 10, 2007 at 5:02 pm

    I just recently started using Trapcode’s Sound Keys, and I feel like I have a good grasp on the plugin, however, I would like to be able to generate more randomness with the values that I create. For example, if I have a solid layer, and apply my sound keys animation to the position value, it seems to just move in one direction: either up and down, left and right, or diagonally. I would like to be able to make it so it moves up and down on one beat, left and right on the next beat, and then diagonally on the next beat, for example. I assume there’s an easy way to manipulate the expression to get this animation, but I’m not very good with expressions.

    Thanks
    Chris

    Fitbikeco88 replied 19 years, 5 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    February 10, 2007 at 8:42 pm

    It’s not simple because to make it work you need to distinguish one “beat” from another. Here’s an expression for Position that seems to work. You’ll need to edit the first three lines to point to your Sound Keys layer, set the amplitude, and the audio threshold level that defines a new beat.

    level = thisComp.layer(“Medium Purple Solid 2”).effect(“Sound Keys”)(“Output 1”);
    amp = 5.0;
    threshold = 10.0;

    above = false;
    frame = Math.round(time / thisComp.frameDuration);
    n = 0;
    while (true){
    t = frame * thisComp.frameDuration;
    if (above){
    if (level.valueAtTime(t) < threshold){ frame++; n = 1; break; } }else if (level.valueAtTime(t) >= threshold){
    above = true;
    }
    if (frame == 0){
    break;
    }
    frame–
    }
    seedRandom(frame,true);
    angle = random(2*Math.PI);
    value + [Math.cos(angle),Math.sin(angle)]*amp*level

    Dan

  • Mylenium

    February 11, 2007 at 1:40 pm

    Like Dan said – AE is not sentient nor is Soundkeys and you have to tell it when to switch. Dan’s stuff is spot on, but you may also simply try to flip the direction based on a fixed time interval:

    seedRandom(time%1,true)

    direction=random[0,1];
    angle=degreesToRadians(90);

    amount=thisComp.layer(“Soundkeys”).effect(“Soundkeys”)(“Output 1”);

    X=Math.sin(angle*direction)*amount;
    Y=Math.cos(angle*direction)*amount;

    [X,Y]

    This will change the direction randomly from vertical to horizontal every second. Change values as needed.

    Mylenium

    [Pour Myl

  • Fitbikeco88

    February 11, 2007 at 4:41 pm

    Thanks guys. I’ve been able to achieve some sort of “randomness” with the information that both of you have provided me. I’m glad I decided to join this forum because you guys really know your stuff.

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