[Pd] Pd's biquad

Frank Barknecht fbar at footils.org
Mon Jan 29 23:55:30 CET 2007


Hallo,
Chuckk Hubbard hat gesagt: // Chuckk Hubbard wrote:

> On 1/28/07, Frank Barknecht <fbar at footils.org> wrote:
> >Frank Barknecht hat gesagt: // Frank Barknecht wrote:
> >
> >> Actually I've just read a nice, not too mathematical explanation of
> >> biquad-filters in Perry Cook's book "Real Sound Synthesis for
> >> Interactive Applications" which I'm currently reading. It's a bit too
> >> expensive to buy just for the biquad pages, but maybe you can find it
> >> in a library.
> >
> >Uhm, and another one is here:
> >http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
> 
> Thanks Frank.  I came across that one a few days ago, still not quite
> through it yet.  I'll see if our library has Perry Cook.

I just remembered, that Cook is a colleage of Julius O. Smith III and
recommends JOS for people who want to dig deeper into the math. And
the good thing is: JOS has a huge amount of texts online. 

One about biquads is here: 
http://ccrma.stanford.edu/~jos/filters/BiQuad_Section.html
then follow the links.

I played around a bit with the [biquad~] today and came up with
attached patch, which is similar to CH's patch. It's attached.

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 635 358 545 442 10;
#N canvas 529 231 558 569 fft 0;
#X obj 19 62 inlet~;
#X obj 85 214 inlet;
#X obj 19 92 rfft~;
#X obj 19 125 *~;
#X obj 50 125 *~;
#X obj 19 155 sqrt~;
#X obj 332 109 block~ 4096 1;
#X obj 19 181 biquad~ 0 0 0 0 1;
#X text 83 93 Fourier series;
#X text 88 146 magnitude;
#X text 86 131 calculate;
#X text 21 3 This subpatch computes the spectrum of the incoming signal
with a (rectangular windowed) FFT. FFTs aren't properly introduced
until much later.;
#X text 83 62 signal to analyze;
#X text 182 166 delay two samples;
#X text 181 182 for better graphing;
#X text 135 216 "bang" into this inlet to graph it;
#X obj 85 288 tabwrite~ \$0-spectrum;
#X obj 19 213 /~ 4096;
#X obj 19 235 rmstodb~;
#X connect 0 0 2 0;
#X connect 1 0 16 0;
#X connect 2 0 3 0;
#X connect 2 0 3 1;
#X connect 2 1 4 0;
#X connect 2 1 4 1;
#X connect 3 0 5 0;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 7 0 17 0;
#X connect 17 0 18 0;
#X connect 18 0 16 0;
#X restore 48 377 pd fft;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-spectrum 2048 float 0;
#X coords 0 100 2047 0 259 140 1;
#X restore 134 130 graph;
#X obj 108 182 bng 15 250 50 0 \$0-plot empty plot 0 -6 0 8 -262144
-1 -1;
#X obj 107 215 tgl 15 0 \$0-auto empty auto 0 -6 0 8 -262144 -1 -1
1 1;
#X obj 85 329 r \$0-plot;
#X obj 137 350 r \$0-auto;
#X obj 133 372 metro 500;
#X obj 48 294 inlet~;
#X obj 233 314 inlet;
#X obj 233 336 b;
#X obj 233 361 s \$0-plot;
#X obj 48 323 *~ 1;
#X connect 4 0 0 1;
#X connect 5 0 6 0;
#X connect 6 0 0 1;
#X connect 7 0 11 0;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 11 0 0 0;
#X coords 0 -1 1 1 300 200 1 100 100;
-------------- next part --------------
#N canvas 82 17 1105 637 10;
#X text 724 317 calculates the following difference equation:;
#X text 725 330 y(n) = ff1 * w(n) + ff2 * w(n-1) + ff3 * w(n-2);
#X text 725 346 w(n) = x(n) + fb1 * w(n-1) + fb2 * w(n-2);
#X text 666 362 Syntax: biquad~ fb1 fb2 ff1 ff2 ff3;
#X text 739 300 2-pole-2-zero-filter;
#X obj 674 301 biquad~;
#X text 749 404 y(n) = g*(w(n) + a1 * w(n-1) + a2 * w(n-2));
#X obj 414 115 pow 2;
#X obj 384 80 t a a;
#X text 401 36 Zero;
#X obj 273 117 pow 2;
#X obj 243 82 t a a;
#X text 255 38 Pole;
#X obj 192 41 r \$0-Fp;
#X obj 333 39 r \$0-Fz;
#X obj 384 59 r \$0-rz;
#X obj 471 349 list prepend set;
#X obj 471 373 list trim;
#X msg 471 394 0.760479 -0.5929 0.63 -0 0;
#X floatatom 841 102 5 0 0 0 - - -;
#X obj 63 260 noise~;
#X obj 53 391 env~;
#X floatatom 53 413 5 0 0 0 - - -;
#X msg 53 355 clear;
#X obj 175 363 biquad~;
#X obj 176 415 spectrum;
#X obj 243 61 r \$0-rp;
#X obj 333 176 t b a;
#X obj 841 119 / 100;
#X floatatom 782 101 5 0 0 0 - - -;
#X floatatom 721 103 5 0 99 0 - - -;
#X obj 721 120 / 100;
#X floatatom 662 102 5 0 0 0 - - -;
#X obj 662 122 * 100;
#X obj 782 121 * 100;
#X obj 782 167 s \$0-Fz;
#X obj 841 167 s \$0-rz;
#X obj 662 166 s \$0-Fp;
#X obj 721 166 s \$0-rp;
#X floatatom 662 145 5 0 0 0 - - -;
#X floatatom 721 144 5 0 0 0 - - -;
#X floatatom 782 144 5 0 0 0 - - -;
#X floatatom 841 145 5 0 0 0 - - -;
#X obj 689 258 table \$0-impulse 64;
#X obj 146 310 tabplay~ \$0-impulse;
#X obj 836 258 s \$0-impulse;
#X obj 146 289 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 836 212 loadbang;
#X obj 317 306 pack 0 0 0 0 1;
#X floatatom 850 17 5 0 0 1 gain - -;
#X obj 850 45 / 100;
#X msg 316 332 \$1 \$2 \$5 \$3 \$4;
#X obj 273 138 * -1;
#X obj 62 296 *~ 1;
#X obj 96 299 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 836 235 const 0 \, 32 1;
#X obj 48 475 *~ 0;
#X obj 88 496 dbtorms;
#X obj 91 477 hsl 64 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144
-1 -1 0 1;
#X obj 48 501 dac~;
#X obj 464 90 r \$0-gain;
#X obj 464 112 t a a a;
#X obj 894 89 s \$0-gain;
#X obj 850 67 t b b a;
#N canvas 0 0 629 487 cosft 0;
#X obj 93 268 cos;
#X obj 93 223 / 44100;
#X obj 93 329 *;
#X obj 273 52 inlet;
#X obj 93 53 inlet;
#X text 93 30 Freq (z or r);
#X text 272 28 reson (z or r);
#X obj 93 358 outlet;
#X obj 137 196 samplerate~;
#X obj 93 144 f;
#X obj 273 97 t b a;
#X obj 93 174 t a b;
#X obj 93 246 * 6.28319;
#X obj 93 293 * 2;
#X text 260 199 Caclulates: 2r * cos(2 * pi * Freq * T);
#X connect 0 0 13 0;
#X connect 1 0 12 0;
#X connect 2 0 7 0;
#X connect 3 0 10 0;
#X connect 4 0 9 0;
#X connect 8 0 1 1;
#X connect 9 0 11 0;
#X connect 10 0 9 0;
#X connect 10 1 2 1;
#X connect 11 0 1 0;
#X connect 11 1 8 0;
#X connect 12 0 0 0;
#X connect 13 0 2 0;
#X restore 192 118 pd cosft;
#N canvas 268 243 629 487 cosft 0;
#X obj 93 268 cos;
#X obj 93 223 / 44100;
#X obj 93 329 *;
#X obj 273 52 inlet;
#X obj 93 53 inlet;
#X text 93 30 Freq (z or r);
#X text 272 28 reson (z or r);
#X obj 93 358 outlet;
#X obj 137 196 samplerate~;
#X obj 93 144 f;
#X obj 273 97 t b a;
#X obj 93 174 t a b;
#X obj 93 246 * 6.28319;
#X text 260 199 Caclulates: +2r * cos(2 * pi * Freq * T);
#X obj 93 293 * 2;
#X connect 0 0 14 0;
#X connect 1 0 12 0;
#X connect 2 0 7 0;
#X connect 3 0 10 0;
#X connect 4 0 9 0;
#X connect 8 0 1 1;
#X connect 9 0 11 0;
#X connect 10 0 9 0;
#X connect 10 1 2 1;
#X connect 11 0 1 0;
#X connect 11 1 8 0;
#X connect 12 0 0 0;
#X connect 14 0 2 0;
#X restore 333 116 pd cosft;
#X obj 333 143 * -1;
#X obj 414 196 * 1;
#X obj 363 197 * 1;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-scope 441 float 4;
#X coords 0 1 440 -1 441 140 1;
#X restore 499 473 graph;
#X obj 228 394 tabwrite~ \$0-scope;
#X connect 7 0 67 0;
#X connect 8 0 65 1;
#X connect 8 1 7 0;
#X connect 10 0 52 0;
#X connect 11 0 64 1;
#X connect 11 1 10 0;
#X connect 13 0 64 0;
#X connect 14 0 65 0;
#X connect 15 0 8 0;
#X connect 16 0 17 0;
#X connect 17 0 18 0;
#X connect 19 0 28 0;
#X connect 20 0 53 0;
#X connect 21 0 22 0;
#X connect 23 0 24 0;
#X connect 24 0 21 0;
#X connect 24 0 25 0;
#X connect 24 0 56 0;
#X connect 24 0 70 0;
#X connect 26 0 11 0;
#X connect 27 0 48 0;
#X connect 27 1 68 0;
#X connect 28 0 42 0;
#X connect 29 0 34 0;
#X connect 30 0 31 0;
#X connect 31 0 40 0;
#X connect 32 0 33 0;
#X connect 33 0 39 0;
#X connect 34 0 41 0;
#X connect 39 0 37 0;
#X connect 40 0 38 0;
#X connect 41 0 35 0;
#X connect 42 0 36 0;
#X connect 44 0 24 0;
#X connect 46 0 44 0;
#X connect 46 0 25 1;
#X connect 46 0 70 0;
#X connect 47 0 55 0;
#X connect 48 0 51 0;
#X connect 49 0 50 0;
#X connect 50 0 63 0;
#X connect 51 0 16 0;
#X connect 51 0 24 0;
#X connect 52 0 48 1;
#X connect 53 0 24 0;
#X connect 54 0 53 1;
#X connect 55 0 45 0;
#X connect 56 0 59 0;
#X connect 56 0 59 1;
#X connect 57 0 56 1;
#X connect 58 0 57 0;
#X connect 60 0 61 0;
#X connect 61 0 68 1;
#X connect 61 1 67 1;
#X connect 61 2 48 4;
#X connect 63 0 29 0;
#X connect 63 1 19 0;
#X connect 63 2 62 0;
#X connect 64 0 48 0;
#X connect 65 0 66 0;
#X connect 66 0 27 0;
#X connect 67 0 48 3;
#X connect 68 0 48 2;


More information about the Pd-list mailing list