Merge branch 'master' of https://scm.cri.ensmp.fr/git/Faustine
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / examples / lfboost.dsp
1 declare name "lfboost";
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("math.lib");
15 import("music.lib");
16
17
18 //----------------------low frequency boost filter -------------------------------
19 // lfboost(F,G)
20 // F : frequency (in Hz)
21 // G : gain (in dB)
22 //
23 //--------------------------------------------------------------------------------
24
25 lfboost(F,G) = TF2( (1 + sqrt(2*V)*K + V*K*K) / denom,
26 2 * (V*K*K - 1) / denom,
27 (1 - sqrt(2*V)*K + V*K*K) / denom,
28 2 * (K*K - 1) / denom,
29 (1 - sqrt(2)*K + K*K) / denom
30 )
31 with {
32 V = db2linear(G);
33 K = tan(PI*F/SR);
34 denom = 1 + sqrt(2)*K + K*K;
35 };
36
37
38
39 //====================low frequency boost process ===============================
40
41 process = vgroup("lowboost", lfboost(
42 nentry("freq [unit:Hz][style:knob]", 100, 20, 150, 1),
43 vslider("gain [unit:dB]", 0, -20, 20, 0.1)
44 ) );