[PD] how do you use biquad~ ?

Jer Welter mrjester at fledge.watson.org
Tue Mar 23 15:48:05 CET 2004


Those "cookbook coefficients" are correct, but you have to normalize to
the PD biquad~ equation.  This involves accounting for the a0 coefficient
(folded into the other coefficients in the PD biquad~), and perhaps
changing the sign of the aN coefficients (which affect they y, or
previous-output, components), (depends on whether your equation specifies
those coefficients as being added or subtracted, I can't remember at the
moment).

Look up Julius Smith's (jos) book on digital filters - there is enough
information in there about the math to translate.  (I sent email on the
same topic to the list earlier this week with the link)

I made a patch which uses the RBJ cookbook to calculate LPF coefficients
for biquad~ in MSP, which is below.  Don't have the time right now to make
a PD version, but cyclone should mostly load it.

Jer

max v2;
#N vpatcher 323 114 914 557;
#P outlet 184 378 15 0;
#P outlet 119 378 15 0;
#P outlet 91 378 15 0;
#P outlet 63 378 15 0;
#P outlet 17 378 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 184 274 63 196617 /~ 1.;
#P newex 119 274 33 196617 /~ 1.;
#P newex 63 274 33 196617 /~ 1.;
#P newex 63 240 35 196617 !-~ 1.;
#P newex 17 305 40 196617 *~ 0.5;
#P newex 184 218 35 196617 !-~ 1.;
#P newex 237 218 33 196617 +~ 1.;
#P newex 119 240 39 196617 *~ -2.;
#P newex 119 136 35 196617 cosx~;
#P newex 184 166 289 196617 *~;
#P newex 463 140 75 196617 expr sinh($f1);
#P inlet 515 54 15 0;
#P newex 463 118 30 196617 !/ 1.;
#P newex 463 96 27 196617 * 2.;
#P message 463 75 21 196617 $1;
#P newex 463 53 45 196617 loadbang;
#P newex 184 136 34 196617 sinx~;
#P newex 279 62 53 196617 dspstate~;
#P newex 184 106 119 196617 /~ 1.;
#P newex 184 83 34 196617 *~ 2.;
#P newex 184 61 70 196617 *~ 3.141593;
#P inlet 184 36 15 0;
#P comment 305 109 139 196617 frequency in radians (omega);
#P comment 490 76 15 196617 Q;
#P comment 16 398 18 196617 b0;
#P comment 63 399 16 196617 b1;
#P comment 91 399 17 196617 b2;
#P comment 119 400 17 196617 a1;
#P comment 185 399 19 196617 a2;
#P comment 276 220 102 196617 a0 (common divisor);
#P window setfont "Sans Serif" 14.;
#P comment 333 303 163 196622 signal-rate biquad LPF coefficient
calculator;
#P fasten 28 0 26 0 68 296 22 296;
#P connect 26 0 31 0;
#P fasten 22 0 27 0 124 172 68 172;
#P connect 27 0 28 0;
#P connect 28 0 32 0;
#P fasten 24 0 28 1 242 263 91 263;
#P connect 26 0 33 0;
#P fasten 12 0 22 0 189 130 124 130;
#P connect 22 0 23 0;
#P connect 23 0 29 0;
#P connect 29 0 34 0;
#P fasten 24 0 29 1 242 263 147 263;
#P connect 9 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P connect 12 0 14 0;
#P connect 14 0 21 0;
#P connect 21 0 25 0;
#P connect 25 0 30 0;
#P connect 30 0 35 0;
#P fasten 21 0 24 0 189 198 242 198;
#P connect 24 0 30 1;
#P connect 13 1 12 1;
#P connect 15 0 16 0;
#P connect 16 0 17 0;
#P fasten 19 0 17 0 520 94 468 94;
#P connect 17 0 18 0;
#P connect 18 0 20 0;
#P connect 20 0 21 1;
#P pop;





More information about the Pd-list mailing list