FORUMS: list search recent posts

Random color on audio beat, then hold color til next beat

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Lionel Vicidomini
Random color on audio beat, then hold color til next beat
on Feb 25, 2013 at 4:02:26 pm

Hello everyone,
I hope the title is self explanatory.
What I aimed to do is very simple but I'm having a really hard time to do it.
I have an audio file. I converted it to keyframe. I want to use each beat on the sound to trigger a color change on a layer. This random color stays put until the next beat happens, then it changes and holds this color til the next beat, and so on...

I know this has to do with the seedRandom as :

seedRandom(seed, true)
where seed changes every time x (for example) reaches let's say 20

I'm stuck there. I guess it has also to do with if/else statement or a while/do.
I know this must be extremely simple, but I just don't get it.

Thanks for any hint !


Return to posts index

Dan Ebberts
Re: Random color on audio beat, then hold color til next beat
on Feb 25, 2013 at 6:22:22 pm

Don't feel bad--it's not extremely simple.

Try this:


threshold = 15.0;

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

above = false;
frame = timeToFrames(time);
while (true){
t = framesToTime(frame);
if (above){
if (audioLev.valueAtTime(t) < threshold){
frame++;
break;
}
}else if (audioLev.valueAtTime(t) >= threshold){
above = true;
}
if (frame == 0){
break;
}
frame--
}

seedRandom(frame,true);
random([0,0,0,1],[1,1,1,1])


Set threshold to the audio amplitude that signifies a beat.

Dan



Return to posts index

Lionel Vicidomini
Re: Random color on audio beat, then hold color til next beat
on Feb 25, 2013 at 6:30:14 pm

Perfect ! It works like a charm.
Ok, now I have to understand it !
At least I was on the right track :)


Return to posts index


Lionel Vicidomini
Re: Random color on audio beat, then hold color til next beat
on Feb 26, 2013 at 3:09:47 pm

I was going to ask a lot of questions about this expression, then I found on your website the template used to do it... with all the explanations I could dreamed of !
I still struggle a bit with all the "while" statement but I'm starting to get the hang of it.
So thanks again !

http://www.motionscript.com/design-guide/audio-trigger.html


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]