Debian Codegraph @

examples/filter/Elliptic-help.ck

raw
1 /////////////////////////////////////////////////////////////
2 // Elliptic //
3 // //
4 // Elliptic implements cascaded IIR filters and a built-in //
5 // elliptical filter design. It is capable of low-pass, //
6 // high-pass, or bandpass filtering with very steep //
7 // slopes. //
8 // //
9 // The atten determines how much of the signal is //
10 // attenuated outside the passband. //
11 // //
12 // Elliptic filters come with a trade-off for their steep //
13 // slopes: they have a certain amount of ripple outside //
14 // the passbands. A very small ripple (0.1 or 0.2 dB) //
15 // produces very little ringing, whereas a large ripple //
16 // (eg. 20 dB) produces a very strong harmonic ring. //
17 // //
18 // The filter design algorithm sometimes can't fulfill the //
19 // design criteria -- a particular combination of cutoff //
20 // frequencies, ripple, and attenuation. If that happens, //
21 // the user is warned that the filter is not initialized, //
22 // and the filter is bypassed. This may happen, for //
23 // instance, if you ask for a very steep attenuation with //
24 // very low ripple. //
25 /////////////////////////////////////////////////////////////
26
27 // Settings
28 //
29 // atten (float): filter attenuation in dB. Default 90.0
30 // ripple (float): filter ripple in dB. Default 0.2
31 // bypass (int): switch bypass on or off. Default 0
32 //
33 // Before using the filter, you must initialize it as a
34 // low-pass (lpf), high-pass (hpf), or band-pass filter and
35 // designate the passband and stopband frequencies.
36 //
37 // lpf (passband Hz, stopband Hz): create a low-pass filter
38 // hpf (stopband Hz, passband Hz): create a high-pass filter
39 //
40 // bpf (lower passband, upper passband, stopband):
41 // (usually these parameters are ascending values.)
42 //
43
44 Noise n => Elliptic ell => dac;
45 0.1 => n.gain;
46
47 80 => ell.atten; // 80 dB attenuation
48 10 => ell.ripple; // 10 dB ripple will cause ringing
49
50 ell.bpf(500,600,650); // create band-pass filter which
51 // passes the range 500-600 Hz
52 // unattenuated, then slopes from
53 // 600-650 Hz (and 450-500 Hz)
54
55 true => ell.bypass; // bypass filter
56 2::second => now;
57
58 false => ell.bypass; // activate filter
59 minute => now;