Debian Codegraph @

examples/filter/FIR-sinc-explicit.ck

raw
1 // FIR filter demo program, Perry R. Cook, Oct 2012
2 // This shows how to load filter coefficients
3 // explicitly, in this case with a Sinc lowpass filter
4
5 Noise n => Gain g => FIR f => WvOut w => dac;
6 w.wavFilename("temp.wav");
7
8 127 => f.order;
9 f.coeff(64,1.0);
10 for (1 => int i; i < 63; i++) {
11 (i * pi)/4.0 => float temp;
12 f.coeff(64-i,Math.cos(i*pi/128)*(Math.sin(temp)/temp));
13 <<< i, f.coeff(64+i,f.coeff(64-i)) >>>;
14 }
15
16 0.2 => g.gain;
17
18 5.0 :: second => now;
19
20 w.closeFile();