Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Scale Triggered by Audio Threshold

  • Scale Triggered by Audio Threshold

    Posted by Rafael Cruz on December 9, 2008 at 7:40 am

    I am looking for an expression that triggers a sudden change in scale when a threshold in audio amplitude is reached, and which then eases back until the next threshold breach.

    So far I’ve successfully linked scaled and amplitude with a simple expression, but that approach is hyper responsive (i.e. the scale property twitches at nearly every keyframe).

    In contrast, I’ve been able to use expressions posted on Dan Ebbert’s site (and pasted below) and get them to respond only to amplitudes above the threshold. But while it works for the wobble effect, and color change; I’m missing the step(s) needed to adjust the code for scale.

    At the moment, when I combine the codes below, the scale expression does its thing at the beginning of the comp and remains unresponsive to the music.
    i’m sure it’s probably a simple issue. i’d very much appreciate any help.

    ~Raf

    here is the code used to trigger

    threshold = 12.0;

    audioLev = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

    above = false;
    frame = Math.round(time / thisComp.frameDuration);
    while (true){
    t = frame * thisComp.frameDuration;
    if (above){
    if (audioLev.valueAtTime(t) < threshold){ frame++; break; } }else if (audioLev.valueAtTime(t) >= threshold){
    above = true;
    }
    if (frame == 0){
    break;
    }
    frame–
    }
    if (! above){
    t = 0;
    }else{
    t = time – frame * thisComp.frameDuration;
    }

    and here is the code i want activated by the “trigger”

    freq =1;
    amplitude = 505;
    decay = 5.0;

    s = amplitude*Math.sin(freq*time*2*Math.PI)/Math.exp(decay*time);
    scale + [s,s]

    Rafael Cruz replied 17 years, 5 months ago 3 Members · 3 Replies
  • 3 Replies
  • Kevin Reiner

    December 9, 2008 at 3:29 pm

    I’m not an expert in expressions so I can’t really help you there. Just wanted to throw my 2 cents in on the plugin trapcode Soundkeys. It would work perfect for this.

    https://www.trapcode.com/products_soundkeys.html

    System Setup (for a more detailed list, see my profile)

    HARDWARE
    Mac Pro 2 x 3 GHz Quad-Core Intel Xeon
    9GB Memory
    Two 16x SuperDrives
    Dual-channel 2Gb Fibre Channel PCI Express card
    Apple Cinema HD Display (23″ flat panel)
    ATI Radeon X1900 XT Graphics Card
    AJA Kona LHe SD/HD capture card
    Apple Xserve Raid 5.6TB

    SOFTWARE
    Mac OS X 10.4.11
    Final Cut Pro Studio 2
    After Effects CS3
    Photoshop CS3
    Illustrator CS3
    Boris Continuum 5
    Sapphire Plug Ins
    Roxio Toast
    Digital Anarchy Anarchist Suite
    ParticleIllusion 3.0
    Trapcode
    Zaxwerks

  • Dan Ebberts

    December 9, 2008 at 4:22 pm

    Just change your second expression to this:

    freq =1;
    amplitude = 505;
    decay = 5.0;

    s = amplitude*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    scale + [s,s]

    and append it to the first expression.

    Dan

  • Rafael Cruz

    December 9, 2008 at 5:16 pm

    Thanks Dan. Now I see that [t]ime wasn’t labeled consistently. so simple! and now it’s working just as it should. I really appreciate the help.

    -and-
    Kevin, thanks for the suggestion. I’ll give soundkey a shot sometime.

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