-
Sin Wave Expression with “Memory” – Triggered with Audio
First I just gotta thank Dan and this community for everything you guys do. I personally would have never learned as much about expressions if not for Dan’s website and the knowledge in this forum. Thanks everyone!!
I am looking to create a variation of Dan’s audio trigger expression seen here (Triggering An Expression With Audio) . Every time the audio is above the threshold I would like to trigger a sin wave, except it needs to have “memory”. As in, when the audio is not in the threshold it will freeze and when the threshold is triggered again, it will continue the sin wave where it left off. I plan on having this expression on the x position. I have put ‘memory’ in quotations because I know expressions don’t have memory. I hope there is some trick or method around this, as this expression could make my project that much better.
Also, another thought to get this to work is a different expression I have, which increases in value every time the audio level increases, but will retain that value and increase each time the audio volume increases.
audioVol = thisComp.layer("Audio").effect("Ignore")("Audio Output");
frames = timeToFrames(valueAtTime(0));
for (t = Math.max(thisComp.displayStartTime,inPoint); t < time; t += thisComp.frameDuration)
{s = audioVol.valueAtTime(t);
frames += s}
framesToTime(frames);If there was a way to apply that to a basic sin wave expression, that could also work.