[music-dsp] 2nd order biquad for envelope detector?

mdsp mdsp at smartelectronix.com
Fri May 21 07:31:38 EDT 2004


>         // the very easy hard knee 1:N compressor
>         double  gain = 1.0;
>         if (env > threshold)
>             gain = gain - (env - threshold) * slope;

I think you want to have a linear slope *in dB*

this is what I do:

gain = 1.0f;
if(env>thres)
    gain = (float)pow(env/thres, - cSlope); //compression

with :
cSlope = 1.0 - 1.0/ratio; // ratio is in [1:40]
thres = pow(10.0,threshold/20.0); //threshold is in dB

this is equivalent to
- converting the enveloppe in dB
- applying the transfer function
- and converting it back to linear.

there's a chapter about that in the DAFX book.

cheers

remy



More information about the music-dsp mailing list