Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions scale mapped to audio amplitude

  • scale mapped to audio amplitude

    Posted by Elizabeth Markus on April 15, 2008 at 2:50 pm

    i have found this expression to map an object’s scale to an audio amplitude layer.

    value*.25*thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”)

    it works well except that i want to control the min and max scale values. right now the object gets too big and too small. i want a more subtle scale effect. is there an easy way to do that? thanks!!!!

    Mike Clasby replied 18 years, 4 months ago 3 Members · 9 Replies
  • 9 Replies
  • Lord Scales

    April 15, 2008 at 4:11 pm

    audioLev = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);
    minAmp = 0; //minimum audio amplititude
    maxAmp = 50; //maximum audio amplitude (I recommend you to put here the highest value of audioLev)
    maxScale = 150; //minimum scale
    minScale = 70; //maximum scale

    value + linear (audioLev, minAmp, maxAmp, minScale, maxScale)

    Lord Scales

  • Mike Clasby

    April 15, 2008 at 4:21 pm

    Dan has a nice expression here:

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

    Here is a hack of that, in terms of percent of Scale:

    minAudio =5;
    maxAudio = 15;
    minStretch = 50;//minimum in percent of scale
    maxStretch = 200;//maximum in percent of scale

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

    s = linear(audioLev, minAudio, maxAudio, minStretch, maxStretch);

    [s,s]

    Twirl down the Both Channels Slider and see what the min and max audio is, then fill in the blanks or use values to clamp the expression.

  • Elizabeth Markus

    April 15, 2008 at 4:46 pm

    thanks! i will try that.

  • Elizabeth Markus

    April 16, 2008 at 1:18 pm

    thanks! but i don’t quite understand. i think i may be too much of a novice to get this. no matter what values i put in, nothing happens.

  • Elizabeth Markus

    April 16, 2008 at 1:29 pm

    Hi Lord Scales,

    For some reason that stretches the object vertically about 200% but not horizontally at all. I cannot get the object to be small enough to stay within the frame. I am really new to this so I apologize if this is an obvious question.

    Thanks!

  • Mike Clasby

    April 16, 2008 at 5:27 pm

    What are the minimum Audio Amplitude levels (twirl down the Both Channels Slider in the Audio Amplitude layer)? Change that firstline to:

    minAmp = 0;

    It was 5 when I tired it and it worked fine for me but if your audio levels are low, below 5, it would never trigger the expression.

    Not to horn into Lord Scales above, but if you change the last line to these two lines below you’ll get that expression to stretch both x and y:

    s = linear (audioLev, minAmp, maxAmp, minScale, maxScale);
    value + [s,s]

  • Elizabeth Markus

    April 16, 2008 at 7:51 pm

    Thanks Mike. When I try that I get a warning “Class ‘global’ has no property or method named ‘minAmp'”

    And then when I tried switching that to minAudio it said it also didn’t recognize minScale. Any suggestions?

    Thanks!

  • Elizabeth Markus

    April 16, 2008 at 7:55 pm

    scratch that last post. i added the new line onto the wrong expression. but now with the fix of changing 5 to 0 it’s working beautifully. Thanks!!!!

  • Mike Clasby

    April 17, 2008 at 5:23 pm

    My bad for having the 5 n the first place. Glad it finally works for you.

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