IIR Filter design
- KVRer
- Topic Starter
- 19 posts since 9 Nov, 2005 from Germany
Hi,
Just in case someone is interested, I wrote a small "easy" tutorial for IIR Filter Design using z-plane some time ago:
http://www.yedey.com/wp-content/uploads ... ammers.pdf
Already got some feedback, but would be interested what you guys think. Don't be to critical I'm not an academic.
Maik
Just in case someone is interested, I wrote a small "easy" tutorial for IIR Filter Design using z-plane some time ago:
http://www.yedey.com/wp-content/uploads ... ammers.pdf
Already got some feedback, but would be interested what you guys think. Don't be to critical I'm not an academic.
Maik
-
very angry mobster very angry mobster https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=11047
- KVRian
- 611 posts since 15 Dec, 2003 from Melbourne, Australia
-
- KVRer
- 15 posts since 11 Nov, 2011
-
- KVRist
- 132 posts since 22 Nov, 2006
Hey thanks for posting this. I came here hoping to find discussion along these lines, but pdfs are better. I've got a biquad impl. but the reference I used leaves out the details on picking coefficients. This looks like it might bridge the gaps in my understanding of the literature.
I'm writing a synth kit module. I'll stick it on github when it's in better shape. I imagine you folks are all writing C, C++ & Obj-C but this is in OCaml so I probably won't bother linking it but ping me if you're interested.
I'm writing a synth kit module. I'll stick it on github when it's in better shape. I imagine you folks are all writing C, C++ & Obj-C but this is in OCaml so I probably won't bother linking it but ping me if you're interested.
-
- KVRer
- 1 posts since 28 Feb, 2015
AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
If we calculate biquads in the form: y[n] = (b0x[n] + b1x[n − 1] + b2x[n − 2]) − (a1y[n − 1] + a2y[n − 2]), then shouldn't our b0 always be a function of gain? In other words, if gain = 0, then y[n] should always equal x[n], right? In RBJ's audio filter cookbook (http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt (http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt)), for example, it lists the coefficients for a high pass filter as:b0 = (1 + cos(w0))/2
b1 = -(1 + cos(w0))
b2 = (1 + cos(w0))/2
a0 = 1 + alpha
a1 = -2*cos(w0)
a2 = 1 - alpha
where w0 IS NOT a function of gain. Meaning if we begin filtering at the start of some audio stream where all x[n − m] values are 0 (and where m>0), in order for y[n] = x[n], b0 must equal 1. Am I wrong in assuming a gain of 0 results in an unadulterated signal? Sorry for the rant, this is more related to IIR Filter Design than your beautiful tutorial!
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
Your equation doesn't have a0.That's what needs to be set to 1, so all other coeffs have to be divided by the value of a0.
If you want an unaltered signal, the only option is to have a0=b0=1, a1=a2=b1=b2=0. Otherwise, you will always alter the signal when you start filtering. I mean, that's the point of filtering...
If you want an unaltered signal, the only option is to have a0=b0=1, a1=a2=b1=b2=0. Otherwise, you will always alter the signal when you start filtering. I mean, that's the point of filtering...
- KVRer
- Topic Starter
- 19 posts since 9 Nov, 2005 from Germany
@miscaudio, not sure if I understand your question correctly, but as Miles1981 pointed out, the only way to make input=output is indeed to set b0 = 1 and all other coeffs to 0.
Normally you don't have to deal with a0 (I don't have it in my tutorial at all). RBJs text uses it to explain scaling, it's indeed the overall inverse gain but it's not a coeff for the filter. That's why the implementation formula in RBJs text looks a bit different:
As you can see a0 is just a scaling factor for all coeffs.
Normally you don't have to deal with a0 (I don't have it in my tutorial at all). RBJs text uses it to explain scaling, it's indeed the overall inverse gain but it's not a coeff for the filter. That's why the implementation formula in RBJs text looks a bit different:
Code: Select all
y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2]
- (a1/a0)*y[n-1] - (a2/a0)*y[n-2]
-
- KVRist
- 229 posts since 29 Apr, 2012
Thanks a lot
- KVRist
- 168 posts since 19 Apr, 2014 from London
Fantastic tutorial. It is very straight to the point and showed me everything I needed to get started with IIR filters.
Only thing I'm not sure about is how the samplerate is factored into the coefficients.
Only thing I'm not sure about is how the samplerate is factored into the coefficients.