New directory tree, with preprocessor/ inside interpretor/.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / examples / lowcut.dsp
1 declare name "lowcut";
2 declare version "1.0";
3 declare author "Grame";
4 declare license "BSD";
5 declare copyright "(c)GRAME 2006";
6
7 //------------------------------------------------------------------
8 // DAFX, Digital Audio Effects (Wiley ed.)
9 // chapter 2 : filters
10 // section 2.3 : Equalizers
11 // page 53 : second order shelving filter design
12 //------------------------------------------------------------------
13
14 import("music.lib");
15
16
17
18 //------------------- low-frequency shelving cut (table 2.3) --------------------
19
20 V0(g) = pow(10,g/-20.0);
21 K(fc) = tan(PI*fc/SR);
22 square(x) = x*x;
23 denom(fc,g) = 1 + sqrt(2*V0(g))*K(fc) + V0(g)*square(K(fc));
24
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)
30 );
31
32
33 //------------------------------ User Interface -----------------------------------
34
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);
37
38
39 //----------------------------------- Process -------------------------------------
40
41 process = vgroup("low-freq shelving cut", lfcut(freq,att));
42