1declare name 		"lfboost";
2declare version 	"1.0";
3declare author 		"Grame";
4declare license 	"BSD";
5declare 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
14import("math.lib");
15import("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
25lfboost(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
41process = vgroup("lowboost", lfboost(
42								nentry("freq (Hz)", 100, 20, 150, 1),
43								vslider("gain (dB)", 0, -20, 20, 0.1)
44				) );
45