-
Accumulating values (one more try)
Hello,
I have searched wide and tall and could not find the answer to my problem anywhere.
I am trying to create a set of expressions that would allow me to drive the animation by audio without the need of using Trapcode’s Sound Keys. Generally the plan is as follows:
I use the standard built-in convert audio to keyframes command and generate the volume amplitude keyframes (my audio is heavy on drums so there is no need to separate frequencies).
By analyzing the audio amp graph I create a simple expression which sets the value of the keyframe to 1 if there is a drum hit and to 0 if there is none. I use the following expression on a Slider Controller named “Reader”:
Math.round(linear(effect("Both Channels")("Slider"),6,7,0,1));I then want to have a second Slider Controller, named “Pusher” that will increase its value each time it sees the Reader jump from 0 to 1.
I detect the change using a simple if/then statement:
reader=effect("Reader")("Slider");
if (reader > reader.valueAtTime(time-thisComp.frameDuration) { ... }Now in the { … } section I would like to insert code that would increase my value. it seems however that AE resets all values at each frame. I tried writing something simple as:
pusher=effect("pusher")("Slider").valueAtTime(time-thisComp.frameDuration) + 1;…but it does not seem to permit any kind of accumulation and resets each frame, effectively simply jumping between default 0 and added 1 values.
Is there any workaround for this? Is it possible to store and accumulate values in AE?
Quba Michalski
qubahq.com