so is it possible to get the gain from the poles and zeros, without calculating all coefficients?
Of Course it is. You must evaluate the transfer function of the filter in the unit circle. For a nice explanation on how to do this and some C code samples, see: Elements of Computer Music by F. R. Moore, Cap.1 pp. 119-133 Best Isi
--- martin brinkmann mnb@martin-brinkmann.de wrote:
hi pd-list!
i have recently tried to build some filters using cpole and czero, not completely unsuccessfull (at least the lowpass sounds somewhat like a lowpass...), but i have a problem calculating the right gain (or attenuation) factor. for the lp it seems to work more or less (ok for a subtractive synth, but still not good enough for effects etc.), but the hp is either too lound for lower frequencies and low resonance, or hardly audible. i think there might be a better way to find out the right gain than 'try and error'. and its getting worse with more poles involved... so is it possible to get the gain from the poles and zeros, without calculating all coefficients?
bis denn! martin
#N canvas 156 137 470 338 10;
#X obj 82 263 dac~; #X floatatom 1 8 5 0 0 0 - - -; #X obj 235 4 hsl 128 15 0.05 0.99 0 1 empty empty empty -2 -6 0 8 -262144 -1 -1 4700 1; #X text 229 -16 res; #X text 91 -17 cut; #X obj 93 1 hsl 128 15 0 128 0 1 empty empty empty -2 -6 0 8 -262144 -1 -1 5600 1; #X obj 162 143 mtof; #X obj 3 47 phasor~ 222; #N canvas 190 170 920 635 simple_reson_lp1 0; #X obj -19 398 cpole~; #X obj 31 440 czero~; #X obj 27 494 outlet~; #X obj -173 141 inlet~; #X obj -53 364 *~; #X obj 31 118 /~ 2; #X obj 32 238 cos~; #X obj 95 182 -~ 0.25; #X obj 96 203 cos~; #X obj 96 256 *~; #X obj 225 183 clip~ 0.05 0.99; #X obj 236 146 inlet~; #X obj -60 305 *~; #X obj -81 266 +~ 2; #X obj -84 237 *~ 0.5; #X obj -27 279 -~; #X obj 32 90 clip~ 0 1; #X obj 36 34 /~ 11025; #X obj 34 5 inlet~; #X text -123 141 audio in; #X text 81 5 cutoff; #X text 287 143 resonance; #X text 55 368 zero at nyquist; #X text 99 35 1/4 samplerate; #X text -128 198 attenuation factor; #X text -128 214 (1-x)*(1/2*angle+2); #X text 70 118 pi/2 for audio cos; #X text -256 396 pole: cos(angle) , sin(angle)+res; #X text 39 220 cosine; #X text 147 191 sine; #X text -310 363 multiply input by attenuation factor; #X text -404 106 4/2008 martin brinkmann; #X text -405 8 slightly crude (especially the attenuatiun factor) lowpass filter design , made without knowing too much of the math involved. frequency is not very exact , but at least it sounds like a reson filter :-); #X text -404 63 a pole is moved along the unit-circle on a kind of rugby-egg-shaped path , while a zero sits at -1 , 0 (nyquist frequency) , which makes a resonant lowpass filter.; #X text 100 54 cutoff (or angle on the unit circle , usually 0..pi (0..nyquist) , but here 0..0.5 because of the cos~ audio object); #X obj -32 246 sig~ 1; #X obj 45 393 sig~ -1; #X obj 104 393 sig~ 0; #X connect 0 0 1 0; #X connect 0 1 1 1; #X connect 1 0 2 0; #X connect 3 0 4 0; #X connect 4 0 0 0; #X connect 5 0 7 0; #X connect 5 0 6 0; #X connect 6 0 0 2; #X connect 6 0 15 1; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 9 0 0 3; #X connect 10 0 9 1; #X connect 11 0 10 0; #X connect 12 0 4 1; #X connect 13 0 12 0; #X connect 14 0 13 0; #X connect 15 0 12 1; #X connect 16 0 5 0; #X connect 16 0 14 0; #X connect 17 0 16 0; #X connect 18 0 17 0; #X connect 35 0 15 0; #X connect 36 0 1 2; #X connect 37 0 1 3; #X restore 102 192 pd simple_reson_lp1; #X connect 1 0 7 0; #X connect 2 0 8 2; #X connect 5 0 6 0; #X connect 6 0 8 1; #X connect 7 0 8 0; #X connect 8 0 0 0; #X connect 8 0 0 1;
#N canvas 69 503 470 338 10;
#X obj 82 263 dac~; #X floatatom 1 8 5 0 0 0 - - -; #X obj 235 4 hsl 128 15 0.05 0.99 0 1 empty empty empty -2 -6 0 8 -262144 -1 -1 4500 1; #X text 229 -16 res; #X text 91 -17 cut; #X obj 93 1 hsl 128 15 0 128 0 1 empty empty empty -2 -6 0 8 -262144 -1 -1 12400 1; #X obj 144 81 mtof; #X obj 3 47 phasor~ 222; #N canvas 167 157 920 635 simple_reson_hp1 0; #X obj -19 398 cpole~; #X obj 49 519 czero~; #X obj 49 591 outlet~; #X obj -173 141 inlet~; #X obj 31 118 /~ 2; #X obj 16 184 cos~; #X obj 95 182 -~ 0.25; #X obj 96 203 cos~; #X obj 96 256 *~; #X obj 225 183 clip~ 0.05 0.99; #X obj 236 146 inlet~; #X obj 33 34 /~ 11025; #X obj 34 5 inlet~; #X text -123 141 audio in; #X text 81 5 cutoff; #X text 287 143 resonance; #X text 99 35 1/4 samplerate; #X text 70 118 pi/2 for audio cos; #X text -256 396 pole: cos(angle) , sin(angle)+res; #X text 29 167 cosine; #X text 147 191 sine; #X text -310 321 multiply input by attenuation factor; #X text 100 54 cutoff (or angle on the unit circle , usually 0..pi (0..nyquist) , but here 0..0.5 because of the cos~ audio object); #X text 55 368 zero at zero frequency; #X obj -59 222 -~; #X obj -45 327 *~; #X obj -92 181 sig~ 1; #X obj 49 392 sig~ 1; #X obj 99 393 sig~ 0; #X obj 32 94 clip~ 0 0.5; #X connect 0 0 1 0; #X connect 0 1 1 1; #X connect 1 0 2 0; #X connect 3 0 25 0; #X connect 4 0 6 0; #X connect 4 0 5 0; #X connect 5 0 0 2; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 8 0 0 3; #X connect 9 0 8 1; #X connect 9 0 24 1; #X connect 10 0 9 0; #X connect 11 0 29 0; #X connect 12 0 11 0; #X connect 24 0 25 1; #X connect 25 0 0 0; #X connect 26 0 24 0; #X connect 27 0 1 2; #X connect 28 0 1 3; #X connect 29 0 4 0; #X restore 101 192 pd simple_reson_hp1; #X connect 1 0 7 0; #X connect 2 0 8 2; #X connect 5 0 6 0; #X connect 6 0 8 1; #X connect 7 0 8 0; #X connect 8 0 0 0; #X connect 8 0 0 1;
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com