Matching a IIR filter to a higher order FIR filter
-
- KVRist
- 189 posts since 29 May, 2005 from Rennes, France
Well, I heard that it is possible to build a IIR filter matching the frequency/phase response of a higher order FIR filter, say for a real-time emulation of a cabinet impulse response. The problem is to match a polynomial in z (FIR) to a rational polynomial (IIR) with lower order. This seems complicated to me. How this could be achieved? Can someone point me to the right direction?
-
- KVRAF
- 8389 posts since 11 Apr, 2003 from back on the hillside again - but now with a garden!
-
Christian Budde Christian Budde https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=25572
- KVRAF
- 1538 posts since 14 May, 2004 from Europe
Within posihfopit I have a similar thing runing, the user "draw" a desired frequency response and the plugin "calculates" the Biquad-IIR coefficients. I have read several papers about how to do it (it is an iterativ algorithm, but can't remember it exactly. One had the so called yulewalk algorith inside, maybe this helps).
Anyway, I decided to shuffle the IIR coefficients some thousand times until a special epsillon is reached. This is not the best method, but it works for me.
If someone knows a better way, please let me know too.
Good luck,
Christian
P.S.: With one approach I used Laurent de Soras "Different Evolution" algorithm, which I have successfully used for other things, but in this case the overhead was bigger then the gain.
Anyway, I decided to shuffle the IIR coefficients some thousand times until a special epsillon is reached. This is not the best method, but it works for me.
If someone knows a better way, please let me know too.
Good luck,
Christian
P.S.: With one approach I used Laurent de Soras "Different Evolution" algorithm, which I have successfully used for other things, but in this case the overhead was bigger then the gain.
-
- KVRist
- Topic Starter
- 189 posts since 29 May, 2005 from Rennes, France
duncanparsons: can you explain a bit more how do you make design he filters depending on the freq plot, i have no experience in filter design (i should have read some books about filter design i guess)
Christian: thanks, this helps. I'll probably use the yulewalk algorithm since I don't care for the execution speed (offline process) and this algorithm is already implemented in scilab. Anyway, can you detail a bit more how you "shuffle" the IIRC coefficients: pure random IIRC coefs each time and you compare the freq plots?
Christian: thanks, this helps. I'll probably use the yulewalk algorithm since I don't care for the execution speed (offline process) and this algorithm is already implemented in scilab. Anyway, can you detail a bit more how you "shuffle" the IIRC coefficients: pure random IIRC coefs each time and you compare the freq plots?
- KVRian
- 1141 posts since 2 Oct, 2001 from Berlin, Germany
If the cab's sound is what you're aiming at, try also modelling the real dimensions. Sounding like a cab is not only a frequency-domain affair but also a function of time. Think of the enclosure as a small reverberating box. That's often neglected and quickly leads to a static sound that just appears to be 'EQed'. Real enclosures live and breathe because the've got 'space' to do so. Try a filtered signal (the driver; also think about distortion) fed through a multitap delay (or an FDN), filter again, put phase reverse here & there and play with the mix of speaker vs. enclosure. You end up with a weird frequency response for freezieQ wrote:say for a real-time emulation of a cabinet impulse response.
Sascha Eversmeier [formerly digitalfishphones]
TOURAGE DSP
croquesolid drum processor- mix real drums fast & focused
TOURAGE DSP
croquesolid drum processor- mix real drums fast & focused
-
- KVRian
- 1153 posts since 10 Dec, 2003
Dunno if this is any help, not that well desinged interface imo but you can set constraints and design 6 or 7 differant types of filters with it.
http://www.icsi.berkeley.edu/~storn/fiwiz.html
It uses differntial evolution, and if you know how to test the frequeny response of the IIR it shouldnt be too dificult to use it to evolve one to fit whatever response you need. I've used it a few times (not for filters tho) and had great results from it.
http://www.icsi.berkeley.edu/~storn/code.html
http://www.icsi.berkeley.edu/~storn/fiwiz.html
It uses differntial evolution, and if you know how to test the frequeny response of the IIR it shouldnt be too dificult to use it to evolve one to fit whatever response you need. I've used it a few times (not for filters tho) and had great results from it.
http://www.icsi.berkeley.edu/~storn/code.html
-
- KVRist
- Topic Starter
- 189 posts since 29 May, 2005 from Rennes, France
Thanks sascha, this is very informative. Anyway, i do not attemp to mimick the real response of cabinets, i just want a quick and dirty cab emulation to test some distortion devices. That's why I asked for lower-order IIR filters 
-
- KVRian
- 562 posts since 1 Jun, 2004 from Berlin
The prony and stmcb functions in Matlab can be used for this. Prony is also available in GNU Octane.
I have used this approach in Tubebaby, where I am using 32 cascaded Biquads for the cab emulation, which are derived from some IRs from Noisevault.
I agree with Sascha though, that the results aren't very realistic, there's more to real cabs than the frequency response.
Anyway, if you want the coeffs just for testing purposes, you may pm me, and I'd be willing to share mine.
I have used this approach in Tubebaby, where I am using 32 cascaded Biquads for the cab emulation, which are derived from some IRs from Noisevault.
I agree with Sascha though, that the results aren't very realistic, there's more to real cabs than the frequency response.
Anyway, if you want the coeffs just for testing purposes, you may pm me, and I'd be willing to share mine.
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4379 posts since 8 Mar, 2004 from Berlin, Germany
if you restrict yourself to purely recursive IIR-filters (filters with feedforward-coeffs identically zero), then you are trying to estimate an auto-regressive (AR) model. this is nothing different than linear prediction (this is the way my, LPC-vocoder works). several algorithms exist to estimate such a model ( i implemented some variation of LMS in the LPC-vocoder but for offline-processing i would recommend the levinson/durbin recursion ). for the more general case of a digital filter with a feedforward-path, you would have to estimate an ARMA (auto-regressive moving average) model. i think, this is quite complicated and it can be shown that ARMA-models can be approximated to arbitraty precision with AR-models if only the order of the AR-model is high enough. for a AR estimation i would feed the impulse response with white noise (which is always the assumed input signal in linear prediction) and then use levinson/durbin on the output signal.
-
Christian Budde Christian Budde https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=25572
- KVRAF
- 1538 posts since 14 May, 2004 from Europe
In other words, if you don't care about matching the phase, it is not a big problem to match the frequency response. It's been a while since I had this topic at the university, but as far as I remember the phase information is cancelled out in one step to get the AR model.braindoc wrote:if you restrict yourself to purely recursive IIR-filters (filters with feedforward-coeffs identically zero), then you are trying to estimate an auto-regressive (AR) model. this is nothing different than linear prediction (this is the way my, LPC-vocoder works). several algorithms exist to estimate such a model ( i implemented some variation of LMS in the LPC-vocoder but for offline-processing i would recommend the levinson/durbin recursion ). for the more general case of a digital filter with a feedforward-path, you would have to estimate an ARMA (auto-regressive moving average) model. i think, this is quite complicated and it can be shown that ARMA-models can be approximated to arbitraty precision with AR-models if only the order of the AR-model is high enough. for a AR estimation i would feed the impulse response with white noise (which is always the assumed input signal in linear prediction) and then use levinson/durbin on the output signal.
Kind regards,
Christian
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4379 posts since 8 Mar, 2004 from Berlin, Germany
really is it? it's some time ago for me, tooChristian Budde wrote: It's been a while since I had this topic at the university, but as far as I remember the phase information is cancelled out in one step to get the AR model.
-
Christian Budde Christian Budde https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=25572
- KVRAF
- 1538 posts since 14 May, 2004 from Europe
The only thing I remember exactly is where I can look. The book is on the attic. I will bring it down tomorrow.braindoc wrote:really is it? it's some time ago for me, tooChristian Budde wrote: It's been a while since I had this topic at the university, but as far as I remember the phase information is cancelled out in one step to get the AR model.
-
- KVRist
- Topic Starter
- 189 posts since 29 May, 2005 from Rennes, France
I think it's time for me to read some theory about AR and ARMA models, and maybe some about LPC
Thanks to all of you.
Anyway, Christian, can you tell me a bit more about the technique you used in posihfopit ?
Anyway, Christian, can you tell me a bit more about the technique you used in posihfopit ?
-
Christian Budde Christian Budde https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=25572
- KVRAF
- 1538 posts since 14 May, 2004 from Europe
It's very simple, but here we go:zieQ wrote:Anyway, Christian, can you tell me a bit more about the technique you used in posihfopit ?
1. calc the desired frequency response (usually given)
2. calc the current frequency response of your biquad filter (formulas can be found in the music dsp archieve).
3. Implement a so called "cost" function: e.g. substract desired and current frequency response for each frequency you have calculated and add these values.
4. Change one property. In my case I change for example the gain of filter 1
5. Check if the new "cost" is less then the old "cost". If so keep the change, if not, skip the change.
6. Continue with Step 4, but with another "property". Repeat until the "costs" are below a certain epsilon.
This method works very well if you need to adjust a higher level of equalizers (e.g. Peak EQs)
It's a bit tricky to find a good "cost" function and the optimal order of properties. One can see, that if you fitted one filter to reduce the cost function perfectly. It's sometimes hard for the others to reduce it even further. For example: You want to do something like this:
Code: Select all
+---+
| |
----+ +----->Code: Select all
+---+
| ^ |
----+/ \+----->Regards,
Christian
P.S.: I've already mentioned that a generic algorithm may give better results, but for me it doesn't work very well and it was slower than this simple approach.

