# [PD] reson~ from max in pd

Tue Mar 9 23:08:29 CET 2010

```Hi,

a friend asked me, wether there is a object similar to the [fffb~] in max/msp
(a "fast fixed filter bank") in pd. I did not find it instantly so I started
to build one after the formula posted in [reson~]s help in max:

y[n] = gain * (x[n] - r * x[n-2]) + c1 * y[n-1] + c2 * y[n-2]

I appended a patch, that I created after this formula. The Problem is, that I
would love to klone the max-object, but at the moment I have only inlets for
r, c1, c2 and gain. What I need is the math to calculate the values for r, c1,
c2 and gain for given center frequency, Q/Bandwith, and gain.

I started reading the chapters on time shifts and delays and filters in
miller-puckettes book and the book of J. O. Smith. But to be honest, I did not
yet understand much of what is writen there. So I thought, there might be
someone arround here, who can give me a fast answer, or who can point me into
the right direction.

If it is the best to try resonz and resonr (I'm on train building pd-extended,
used vanilla before), I'll accept that. On the other hand, I would be realy
curious about the math that is used to solve this problem.

Thank you very much!

Bjoern

#N canvas 611 38 615 510 10;
#X obj 105 -13 inlet~;
#X obj 105 394 outlet~;
#X obj 153 218 delwrite~ del3;
#X obj 125 348 delwrite~ del2;
#X obj 105 121 +~;
#X obj 104 239 +~;
#X obj 104 320 +~;
#X obj 125 99 *~;
#X obj 122 218 *~;
#X obj 138 299 *~;
#X obj 239 -10 inlet~;
#X text 239 -27 r;
#X obj 307 -10 inlet~;
#X obj 383 -7 inlet~;
#X text 303 -33 c1;
#X text 389 -26 c2;
#X obj 124 14 delwrite~ del1 1;
#X obj 125 78 delread~ del1;
#X obj 123 198 delread~ del2 1;
#X obj 138 278 delread~ del3 1;
#X obj 427 134 samplerate~;
#X msg 387 134 1;
#X obj 387 155 /;
#X floatatom 387 198 0 0 0 0 - - -;
#X obj 387 112 t b b;
#X obj 387 176 * 1000;
#X obj 387 221 s one_sample;
#X obj 125 34 r one_sample;
#X obj 125 55 * 2;
#X obj 131 177 r one_sample;
#X obj 147 254 r one_sample;
#X obj 105 150 *~;
#X obj 455 -4 inlet~;
#X text 456 -22 gain;
#X connect 0 0 4 0;
#X connect 0 0 16 0;
#X connect 4 0 32 0;
#X connect 5 0 6 0;
#X connect 6 0 1 0;
#X connect 6 0 3 0;
#X connect 7 0 4 1;
#X connect 8 0 5 1;
#X connect 9 0 6 1;
#X connect 10 0 7 1;
#X connect 12 0 8 1;
#X connect 13 0 9 1;
#X connect 17 0 7 0;
#X connect 18 0 8 0;
#X connect 18 0 2 0;
#X connect 19 0 9 0;
#X connect 20 0 22 1;
#X connect 21 0 22 0;
#X connect 22 0 26 0;
#X connect 23 0 25 0;
#X connect 24 0 27 0;
#X connect 25 0 21 0;
#X connect 25 1 20 0;
#X connect 26 0 24 0;
#X connect 28 0 29 0;
#X connect 29 0 17 0;
#X connect 30 0 18 0;
#X connect 31 0 19 0;
#X connect 32 0 5 0;
#X connect 33 0 32 1;

```