Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Sin Wave Expression with “Memory” – Triggered with Audio

  • Sin Wave Expression with “Memory” – Triggered with Audio

    Posted by David Kaminski on March 11, 2016 at 10:14 pm

    First I just gotta thank Dan and this community for everything you guys do. I personally would have never learned as much about expressions if not for Dan’s website and the knowledge in this forum. Thanks everyone!!

    I am looking to create a variation of Dan’s audio trigger expression seen here (Triggering An Expression With Audio) . Every time the audio is above the threshold I would like to trigger a sin wave, except it needs to have “memory”. As in, when the audio is not in the threshold it will freeze and when the threshold is triggered again, it will continue the sin wave where it left off. I plan on having this expression on the x position. I have put ‘memory’ in quotations because I know expressions don’t have memory. I hope there is some trick or method around this, as this expression could make my project that much better.

    Also, another thought to get this to work is a different expression I have, which increases in value every time the audio level increases, but will retain that value and increase each time the audio volume increases.

    audioVol = thisComp.layer("Audio").effect("Ignore")("Audio Output");
    frames = timeToFrames(valueAtTime(0));
    for (t = Math.max(thisComp.displayStartTime,inPoint); t < time; t += thisComp.frameDuration)
    {s = audioVol.valueAtTime(t);
    frames += s}
    framesToTime(frames);

    If there was a way to apply that to a basic sin wave expression, that could also work.

    David Kaminski replied 10 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Kalleheikki Kannisto

    March 12, 2016 at 10:29 am

    An expression would need to be cumulative, i.e. calculate all preceding frames. It is likely to come to a grinding halt before you reach one minute, as by that time you calculate the value for 1500 frames to get the value for a single frame, and goes up from there.

    A better approach would be to use Soundkeys which can generate a cumulative output, which you can then link to some sine math expressions.

  • David Kaminski

    March 13, 2016 at 3:50 pm

    That works, thank you!

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