float normIn;
float c;
normIn = in * (1 - in < 0 & 2);
c = release + normIn >= out & (attack - release);
out = c * (out - normIn) + normIn;
It seems 'attack' and 'release' need to be very near unity to function but I can't work out how to use millisecond values other than trial and error. 😕
exonerate ·
The stock envelopes co-eff calculation is already kind of time based,
the minimum knob value is 0.001 which is equal to one millisecond so..
0.01 would equal ten milliseconds
and 1 would equal one second.
So if your wanting to start with values in actual milliseconds like 256 (without the decimal) then you can just divide that by 1000 (or better still multiply by 0.001) and feed it into the current co-eff calculation module.
cheers 😉
exo
oddson ·
Not the stock envelopes, the code used in the stock envelope follower.
I understand now what the code is doing
normIn = in * (1 - in < 0 & 2);
absolute value of the input signal: |x|.
c = release + normIn >= out & (attack - release);
c is 'attack' or 'release' coefficient depending on whether |x|<y(n-1)
out = c * (out - normIn) + normIn;
Standard lowpass filter with c = 1-alpha on the normalized signal.
So... just a bit of algebra to go...
oddson ·
alpha = [(f*2pi)^-1*SR+1]^-1
EnvFollowMS.osm
I haven't tested it thoroughly but I think it's correct.
aliasant ·
Nice work oddson.
Really nice.
sunsynth ·
Thanks oddson!
really usefull in my project... 🙂
The pro like to see details (like ms) under a knob 😉
SUNsynth
Andrew J ·
oddson wrote: alpha = [(f*2pi)^-1*SR+1]^-1
EnvFollowMS.osm
I haven't tested it thoroughly but I think it's correct.
oddson, your schematic still includes the coeff converters inside the stock follower - you need to bypass them.
I created an analyser to send an impulse into the follower and time how long it takes to reach a threshold value. Attack time matches exactly for a threshold of 99.805%.
This is good as I now realise the different code I'm using is out by a factor of 10! Should've checked it earlier 😮
I'll post the analyser schematic later if people are interested.
oddson ·
😊 opps...
I guess I was putting together the example file from my working one (which had test outputs and other junk) and took the whole follower module instead of the enclosed follower code module.
I've posted the corrected version to the link above... (it's just replacing the code module for the enclosing one
Thanks also for confirming the math worked out... I didn't occur to me to try in impulse signal.
aliasant ·
Andrew.
That analyzer osm would be much appreciated.
I have an Env Foll that I would like to check.
Besides. I love analyzing things =)
Andrew J ·
Here you go Martin: http://www.box.net/shared/s6fu93p1l8
-Andrew
aliasant ·
Nice one Andrew. Thank you very very muchos.
aliasant ·
Thanx again Andrew.
This confirmed what I already suspected.
That my Env Follower used its own scale 😉
2 ms was actually about 34 ms !
I recalibrated and now it seems to work as it should.
but.
How can I do the same to the release time? If Attack was off by that much chances are Release time is too.
Is there a simple way to do this with the stuff you alwasy provided or does it require a new testing module thingie?
UPDATE!: Release times seems to be way off.
We really need to check that. I "Installed this env follower in a vu of mine and set the attack to 10 and I have to set the releasetime to 3000 for it to look normal.. 3seconds? That just cant be right.
Andrew J ·
Easy - release time added: http://www.box.net/shared/s6fu93p1l8
aliasant ·
Andrew.
You are a lifesaver!
Out of words!
Wrote something here? To have a post removed or your name hidden, write to [email protected].