Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Color Expression with Audio

  • Color Expression with Audio

    Posted by Andrew Pientka on January 31, 2008 at 4:48 pm

    Dear Creative Cow,

    I’m working on a project where I need to randomize color in text, to the beat of an audio track. The effect that I’m looking for, is that the color will “cut” or change immediately to a different pigment, with the beat of the music. Is there an expression that can do this for me? Thanks.

    Kalleheikki Kannisto replied 7 years, 5 months ago 5 Members · 12 Replies
  • 12 Replies
  • Dan Ebberts

    January 31, 2008 at 6:24 pm

    Something like this should work:

    threshold = 10.0;

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

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

    seedRandom(n,true);
    random([1,1,1]) + [0,0,0,1];

    You may have to adjust the value of “threshold”.

    Dan

  • Andrew Pientka

    February 5, 2008 at 2:47 pm

    Hi Dan,

    Just wanted to say thank you very much, the expression worked wonderfully.

  • Rafael Cruz

    November 21, 2008 at 5:32 pm

    I tried using this expression on the hue setting of the Color Balance (HLS) effect and it didn’t work. The problem seems to be that there are too many values in the code for the property (hue) that i’m trying to manipulate.

    Is there another effect that I should apply this expression to in order to have random color change in time with music?

  • Dan Ebberts

    November 21, 2008 at 7:41 pm

    Try changing the last line of the expression to this:

    random(360)

    Dan

  • Rafael Cruz

    November 22, 2008 at 1:49 am

    Thanks Dan!

    The change worked.
    I had come to suspect that the problem was with the last line but I didn’t know what to do to correct it.

  • Deepak Kumar

    November 14, 2018 at 6:24 am

    Can Anyone Tell Me How This Expression Works. Why Color Reacts To That Value?

  • Dan Ebberts

    November 14, 2018 at 7:36 am

    Which value are you talking about?

    Dan

  • Deepak Kumar

    December 4, 2018 at 6:18 am

    Value which is Evaluated by that expression. how we are telling AE to Change Value of Color tone. Why it reacting With Color Shade?

  • Deepak Kumar

    December 4, 2018 at 6:30 am

    Value which is Evaluated by that expression. how we are telling AE to Change Value of Color tone. Why it reacting With Color Shade?

  • Kalleheikki Kannisto

    December 9, 2018 at 10:48 am

    If the question is WHERE does this expression go, it would go to the color value either in the layer itself if it has one (such as in shape layer), or the color value of the fill effect, for instance, if you’re using that to color something that doesn’t have color option in it directly.

    Kalleheikki Kannisto
    Senior Graphic Designer

Page 1 of 2

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