|Envelope follower with different attack and release|
References : Posted by Bram
xxxx_in_ms is xxxx in milliseconds ;-)
attack_coef = exp(log(0.01)/( attack_in_ms * samplerate * 0.001));
release_coef = exp(log(0.01)/( release_in_ms * samplerate * 0.001));
envelope = 0.0;
tmp = fabs(in);
if(tmp > envelope)
envelope = attack_coef * (envelope - tmp) + tmp;
envelope = release_coef * (envelope - tmp) + tmp;
Added on : 18/01/03 by jm[ AT ]kampsax[ DOT ]dtu[ DOT ]dk
the expressions of the form:
xxxx_coef = exp(log(0.01)/( xxxx_in_ms * samplerate * 0.001));
can be simplified a little bit to:
xxxx_coef = pow(0.01, 1.0/( xxxx_in_ms * samplerate * 0.001));
Added on : 28/03/03 by kainhart[ AT ]hotmail[ DOT ]com
Excuse me if I'm asking a lame question but is the envelope variable the output for the given input sample? Also would this algorithm apply to each channel independently for a stereo signal? One more question what is an Envelope Follower, what does it sound like?
Added on : 22/10/03 by yanyuqiang[ AT ]hotmail[ DOT ]com
What's the difference between this one and the one you posted named 'Envelope detector'? Different definiton? What's the exact definition of release time and attack time?
Added on : 01/07/07 by scoofy[ AT ]inf[ DOT ]elte[ DOT ]hu
Here the definition of the attack/release time is the time for the envelope to fall from 100% to 1%. In the other version, the definition is for the envelope to fall from 100% to 36.7%. So in this one the envelope is about 4.6 times faster.
Added on : 12/01/15 by dtpietrzak[ AT ]gmail[ DOT ]com
What if you want 0ms attack with > 0ms release? 0ms attack in the current equation results in attack_coef = exp ( log(0.01) / 0 ) ) which is not a number due to the division by 0. Would using attack_coef = 0 instead result in an accurate algorithm?
|Add your own comment|
Comments are displayed in fixed width, no HTML code allowed!