3 declare author "Grame";
5 declare copyright "(c)GRAME 2006";
7 //------------------------------------------------------------------
8 // DAFX, Digital Audio Effects (Wiley ed.)
10 // section 2.3 : Equalizers
11 // page 53 : second order shelving filter design
12 //------------------------------------------------------------------
18 //------------------- low-frequency shelving cut (table 2.3) --------------------
20 V0(g) = pow(10,g/-20.0);
21 K(fc) = tan(PI*fc/SR);
23 denom(fc,g) = 1 + sqrt(2*V0(g))*K(fc) + V0(g)*square(K(fc));
25 lfcut(fc, g) = TF2( (1 + sqrt(2)*K(fc) + square(K(fc))) / denom(fc,g),
26 2 * (square(K(fc)) - 1) / denom(fc,g),
27 (1 - sqrt(2)*K(fc) + square(K(fc))) / denom(fc,g),
28 2 * (V0(g)*square(K(fc)) - 1) / denom(fc,g),
29 (1 - sqrt(2*V0(g))*K(fc) + V0(g)*square(K(fc))) / denom(fc,g)
33 //------------------------------ User Interface -----------------------------------
35 freq = hslider("freq [unit:Hz][style:knob]", 100, 20, 5000, 1);
36 att = hslider("attenuation [unit:dB][style:knob]", 0, -96, 10, 0.1);
39 //----------------------------------- Process -------------------------------------
41 process = vgroup("low-freq shelving cut", lfcut(freq,att));