I am already not quite on top of biquad filters, but as I research them I see Pd's version looks a lot different than the other ones I see around. Is it comparable? I can see that it should be IIR, as past values of w can be used in the current value, but I can't tell much else about it. Anyone know a reference explaining this kind of setup?
-Chuckk
Hi, Chuck
Biquad filters are based on a finite-difference equation: y(n)=ff1*w(n)+ff2*w(n-1)+ff3*w(n-2) w(n)=x(n)+fb1*w(n-1)+fb2*w(n-2)
Now, we can get rid of w, because it's basically a dummy variable and write everything in terms of x and y. Y is the output, and X is the input
w(n)-fb1*w(n-1)-fb2*w(n-2)=x(n) ff1*w(n)+ff2*w(n-1)+ff3*w(n-2)=y(n) so,
y(n)-fb1*y(n-1)-fb2*y(n-2)=ff1*x(n)+ff2*x(n-1)+ff3*x(n-2)
ff stands for feedforward, fb stands for feedback The left side of this equation is the IIR part (feedback), the right side is the FIR part (feedforward). Usually, digital filters like these use a z-transform to write transfer functions (relations of output/input) where z^(-1) is the unit delay operator (one sample delay) Y/X=(ff1 + ff2*z^(-1) + ff3*z^(-2))/(1 - fb1*z^(-1) - fb2*z^(-2)) again, the numerator is the feedforward part, the denominator is the feedback part
Often, biquad filter equations are written with a plus, instead of a minus on the feedback. Is this one of the differences you find?
As for references, I have nothing in particular to suggest. I just have a digital control systems textbook with a z-transform table.
Here's an experiment I was playing with a while back, making a percussion instrument from biquad filters. I used the table to find an expression for damped sines (ds.pd), and it goes like this:
Z[ a^n*sin(b*n)]=a*sin(b)*z^(-1)/ ( 1 - 2*a*cos(b)*z^(-1) + a^2*z^(-2) )
So, then, I just worked out some formulas to calculate a and b, given decay time by 20dB (factor 10) and a fundamental frequency. Then, I put those calculations into the format of pd's biquad filter. (These objects like damped sines are just band-pass filters, and when you hit them with an impulse they ring at the fundamental frequency)
You can find different types of expressions for biquad filters to do efficient low-pass filtering, band-pass filtering, and high-pass filtering. And you can put several of them together to make filters of higher order. Probably some other things I'm missing?
Later, Chuck
On 1/28/07, Chuckk Hubbard badmuthahubbard@gmail.com wrote:
I am already not quite on top of biquad filters, but as I research them I see Pd's version looks a lot different than the other ones I see around. Is it comparable? I can see that it should be IIR, as past values of w can be used in the current value, but I can't tell much else about it. Anyone know a reference explaining this kind of setup?
-Chuckk
-- "Far and away the best prize that life has to offer is the chance to work hard at work worth doing." -Theodore Roosevelt
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hallo, Charles Henry hat gesagt: // Charles Henry wrote:
As for references, I have nothing in particular to suggest. I just have a digital control systems textbook with a z-transform table.
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.
Nice percussion patch btw. it's very similar to what Cook is writing about in his book in the filter chapter.
Frank Barknecht _ ______footils.org_ __goto10.org__
Hallo, 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
Frank Barknecht _ ______footils.org_ __goto10.org__
On 1/28/07, Frank Barknecht fbar@footils.org wrote:
Hallo, 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.
-Chuckk
Hallo, Chuckk Hubbard hat gesagt: // Chuckk Hubbard wrote:
On 1/28/07, Frank Barknecht fbar@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.
Frank Barknecht _ ______footils.org_ __goto10.org__
Nice patch. I like being able to put the poles and zeros somewhere and then see the impulse response. That's cool. I would probably change the pole radius param so that it gets asymptotically close to 1 without ever touching the unit circle (it took me a little while to figure out how it works) Chuck
On 1/29/07, Frank Barknecht fbar@footils.org wrote:
Hallo, Chuckk Hubbard hat gesagt: // Chuckk Hubbard wrote:
On 1/28/07, Frank Barknecht fbar@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__
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On 1/29/07, Frank Barknecht fbar@footils.org wrote:
Hallo, Chuckk Hubbard hat gesagt: // Chuckk Hubbard wrote:
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.
This is awesome, thanks for sharing it. I was wondering if people using biquads just came up with the numbers off the top of their heads, I guess not. This is really educational. I came across the JOS text before, too, but was quickly overwhelmed. I hope to make my way through the whole manuscript.
-Chuckk
Hi Chuck. Thanks for the rundown. This mostly makes sense to me, except this:
w(n)-fb1*w(n-1)-fb2*w(n-2)=x(n) ff1*w(n)+ff2*w(n-1)+ff3*w(n-2)=y(n) so,
y(n)-fb1*y(n-1)-fb2*y(n-2)=ff1*x(n)+ff2*x(n-1)+ff3*x(n-2)
I can't seem to connect them. The dummy-variable equations seem unnecessarily dense. But, so there's nothing special about a biquad filter; just a 2nd-order IIR filter. -Chuckk
On 1/29/07, Chuckk Hubbard badmuthahubbard@gmail.com wrote:
w(n)-fb1*w(n-1)-fb2*w(n-2)=x(n) ff1*w(n)+ff2*w(n-1)+ff3*w(n-2)=y(n) so,
y(n)-fb1*y(n-1)-fb2*y(n-2)=ff1*x(n)+ff2*x(n-1)+ff3*x(n-2)
I got it now. I don't understand why both expressions are useful, but I see that they're the same.
-Chuckk
I got it now. I don't understand why both expressions are useful, but I see that they're the same.
Exactly. There's really no reason to use one or the other. The two-equation form is the canonical representation, but the equations can be written as a single equation, which sometimes appears in textbooks, too. The order of calculating the IIR part and the FIR part can be exchanged. But that's all just computations. It's not really useful to have the distinction unless you're actually programming the filter, and trying to optimize your code. It's enough to see that there are a few different formulations of the same thing.
A few other functions that you can make with these are integrators and differentiators. Not just simple ones, we can actually make integrators/differentiators of higher precision, by using several of them. Since all polynomials over the real number field can be decomposed into first/second order factors, we can build filters of arbitrary order (if we know how to factor them). Beyond a certain point, it becomes more efficient to use fft rather than biquads.