Hello Kevin. Thank you for such a quick and indepth reply! This is amazing.
There is but one problem with the code below:
lines = 100;
maxAmp = 18;
target = thisComp.layer("Audio Amplitude");
amp = target.effect("Both Channels")("Slider");
smpl = amp.numKeys / lines;
smplT = framesToTime((index - target.index) * smpl - (smplT / 2));
avg = amp.smooth(framesToTime(smpl)/2, smpl, smplT)
s = Math.min(100,linear(avg,0,maxAmp,0,100));
[100,s]
When I use it in that form, it drops an error on me:
After Effects warning: Class ‘global’ has no property or method named ‘smplT’
Epression disabled.
Error occured at line 6.
Comp: ‘Comp 1’
Layer: 2 (‘Deep red solid 1’)
Property: ‘Scale’
I’m no programmer, but is that due to the smplT variable being used at the end of line 6 (smplT / 2) before it has any value? I mean in line 6 we set a variable smplT, and part of it is being controlled by smplT itself (that has no value yet). After changing the variable name to ‘smpl’ at the end of line 6 it seems to work alright (atleast looks alright). But I’m too much of a beginner to assess if it’s ‘doing it right’ 🙂
I will test it out when I’m at work and fiddle with the expressions a bit.
Thank you so much for your help Kevin, I’m in your debt!
So glad I stumbled upon CreativeCow 🙂
I will keep you posted with the updates.
—–
Mac Smiechowski