Is it possible to remap an IIR prototype filter to shelving/Notch/Peaking filters?

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

I know how to design a lowpass, normalized IIR Bessel/Butter/Cheby I/Cheby II/elliptic filter, and I know how to transform that into a LP/HP/BP/BS filter at non-normalized frequencies, but I'm completely stumped on if it's possible to transform the prototype filter instead into a high shelf/low shelf/peak/notch filter. Is it?

No workarounds - I know I could simulate a peak/notch with traditional BP/BS using an arbitrary narrow band, and an equiripple FIR would give me a high shelf/low shelf design, but that's not what I'm asking...I'm curious if there are open source formulas to convert an arbitrary order (not just a single biquad) H(z) LP prototype IIR into a high/low shelf or peak/notch filter in the same manner as it can be transformed into the traditional LP/HP/BP/BS at arbitrary frequencies.

(I guess the alternative is to know the formula for a generic high shelf/low shelf/peak/notch filter of arbitrary order and frequency, which I also don't know, beyond 2nd order)

Post

By prototype filter, do you mean the s-domain low pass transfer function?
Last edited by keithwood on Fri Jan 12, 2024 7:58 pm, edited 2 times in total.

Post

Yes, that's probably clearest, going from the s-domain, LP, normalized frequency prototype. I could also do it after an initial transform to a normalized z domain too. Just looking for something higher-order than RBJ's second order biquads.

Post

It's a while since I looked at the maths but if I remember correctly, the mappings from low to high pass and band pass can be applied to a high (or low) shelf to get to the low (or high) shelf and band shelf. I've not encountered a mapping that gets you from a low pass to a shelf.

Post

The classic paper on higher order filters is High-Order Digital Parametric Equalizer Design by S. Orfanidis.

Post

keithwood wrote: Fri Jan 12, 2024 8:00 pm The classic paper on higher order filters is High-Order Digital Parametric Equalizer Design by S. Orfanidis.
Keithwood, if you ever visit the Virginia area in the US, I'd like to buy you a few beers. Ideal reference.

Post

AnalogGuy1 wrote: Fri Jan 12, 2024 8:12 pm Keithwood, if you ever visit the Virginia area in the US, I'd like to buy you a few beers. Ideal reference.
You're welcome!

Post

Transformations into HP/BP/BS as well as change of cutoff all involve mapping of the frequency axis, which allows (potentially) to implement the transformation as a substitution for the s variable. However it's not possible to map an LP (or a similar filter) to a shelving one by frequency axis mapping, since the filter gain needs to take a different range of values.

Some approaches to design IIR shelving filters are covered in Chapter 10 of The Art of VA Filter Design, but those are not simple substitution formulas.

Post

AnalogGuy1 wrote: Fri Jan 12, 2024 7:37 pm I know how to design a lowpass, normalized IIR Bessel/Butter/Cheby I/Cheby II/elliptic filter, and I know how to transform that into a LP/HP/BP/BS filter at non-normalized frequencies, but I'm completely stumped on if it's possible to transform the prototype filter instead into a high shelf/low shelf/peak/notch filter. Is it?
I'm not sure how to go about with designs that have zeroes.. but for all-pole prototypes (Bessel, LR, Butterworth, Cheb1?) you can basically take the poles, place zeroes at the same locations and then offset the poles and zeroes in frequency in different directions and you have a shelving filter. This is basically how RBJ shelves work too, but you can do it with any higher order all-pole just as well.

Similarly, again starting with all-pole prototype, we can perform BP-transform to get a BP twice the order of the prototype and bandwidth set by the "bandpass Q" which would be a parameter for the usual transform... and if we do the same "replicate poles as zeroes" thing.. but transform then into bandpass using different "bandpass Q" (ie. bandwidth) values (just discard the zeroes that BP transform would put at DC), we'll get a peaking filter... which is again how RBJ peaks essentially work (if we start from a 1st order prototype). Note though that you absolutely HAVE TO do a proper BP transform here and not just build one as a combination of LP and HP. :)

A notch is essentially just a special case of a peaking design where the gain at the cutoff is set to zero by setting the Q of the zeroes to infinity. The Q of the zeroes is only needed as 1/Q=0 so this works fine in finite math. In this case though, we don't want to do the "symmetric peak" where we'd adjust poles and zeroes in different directions, rather we'll just keep the Q of the poles as-is.

edit: it probably makes sense to do these designs on the Laplace s-plane and then transform using BLT, but care must be taken that only one frequency prewarping constant is used for the whole thing (eg. typically the nominal cutoff)

Post

Z1202 wrote: Fri Jan 12, 2024 9:07 pm Transformations into HP/BP/BS as well as change of cutoff all involve mapping of the frequency axis, which allows (potentially) to implement the transformation as a substitution for the s variable. However it's not possible to map an LP (or a similar filter) to a shelving one by frequency axis mapping, since the filter gain needs to take a different range of values.

Some approaches to design IIR shelving filters are covered in Chapter 10 of The Art of VA Filter Design, but those are not simple substitution formulas.
Oh, that's nice too; Chapter 2.12 of Art of VA Filter Design gives H_lowshelf_proto(s) = 1/(1 - k H_LP_proto(s)). (It's not worked out like this in the paper, which is only given for a 1 pole design, but the mechanism can be abstracted to this). Very nice!

Post

AnalogGuy1 wrote: Fri Jan 12, 2024 9:45 pm Oh, that's nice too; Chapter 2.12 of Art of VA Filter Design gives H_lowshelf_proto(s) = 1/(1 - k H_LP_proto(s)).
This is a pretty ancient revision of the book you're linking to, which is missing lots of shelving filter information present in the latest revision found here.

Post

mystran wrote: Fri Jan 12, 2024 9:22 pm
AnalogGuy1 wrote: Fri Jan 12, 2024 7:37 pm I know how to design a lowpass, normalized IIR Bessel/Butter/Cheby I/Cheby II/elliptic filter, and I know how to transform that into a LP/HP/BP/BS filter at non-normalized frequencies, but I'm completely stumped on if it's possible to transform the prototype filter instead into a high shelf/low shelf/peak/notch filter. Is it?
I'm not sure how to go about with designs that have zeroes.. but for all-pole prototypes (Bessel, LR, Butterworth, Cheb1?) you can basically take the poles, place zeroes at the same locations and then offset the poles and zeroes in frequency in different directions and you have a shelving filter. This is basically how RBJ shelves work too, but you can do it with any higher order all-pole just as well.

Similarly, again starting with all-pole prototype, we can perform BP-transform to get a BP twice the order of the prototype and bandwidth set by the "bandpass Q" which would be a parameter for the usual transform... and if we do the same "replicate poles as zeroes" thing.. but transform then into bandpass using different "bandpass Q" (ie. bandwidth) values (just discard the zeroes that BP transform would put at DC), we'll get a peaking filter... which is again how RBJ peaks essentially work (if we start from a 1st order prototype). Note though that you absolutely HAVE TO do a proper BP transform here and not just build one as a combination of LP and HP. :)

A notch is essentially just a special case of a peaking design where the gain at the cutoff is set to zero by setting the Q of the zeroes to infinity. The Q of the zeroes is only needed as 1/Q=0 so this works fine in finite math. In this case though, we don't want to do the "symmetric peak" where we'd adjust poles and zeroes in different directions, rather we'll just keep the Q of the poles as-is.

edit: it probably makes sense to do these designs on the Laplace s-plane and then transform using BLT, but care must be taken that only one frequency prewarping constant is used for the whole thing (eg. typically the nominal cutoff)
Thanks, mystran. I'll see if I can extract the method that RBJ used for biquads and apply it to the general case. I wasn't expecting to get any leads; thanks to this group I'll be able to try a few different approaches and see which works best for my use case. Thanks all!

Post

AnalogGuy1 wrote: Fri Jan 12, 2024 10:13 pmI'll see if I can extract the method that RBJ used for biquads and apply it to the general case.
Actually you can also take RBJ biquads (or whatever shelving filters) and simply raise their order by using the "Butterworth filters of the 2nd kind" transformation described in Chapter 8 of the same book ;)

Post

AnalogGuy1 wrote: Fri Jan 12, 2024 10:13 pm Thanks, mystran. I'll see if I can extract the method that RBJ used for biquads and apply it to the general case. I wasn't expecting to get any leads; thanks to this group I'll be able to try a few different approaches and see which works best for my use case. Thanks all!
I pretty much just described it: for shelves, offset poles and zeroes in different directions, for peaks adjust the Q in different directions. Note that you probably want to divide the desired dBgain by the order before computing the offsets to get consistent results independent of the order.

Post

mystran wrote: Fri Jan 12, 2024 9:22 pm I'm not sure how to go about with designs that have zeroes.. but for all-pole prototypes (Bessel, LR, Butterworth, Cheb1?) you can basically take the poles, place zeroes at the same locations and then offset the poles and zeroes
The procedure that I describe here:

http://rs-met.com/documents/dsp/LowShel ... otypes.pdf

should work for filters with (finite) zeros, too. I implemented this stuff in a little Matlab Toolbox back then:

http://rs-met.com/open_source/BesselFilterDesign.zip

There, I apply it to Bessel filters but (if I remember correctly), I also tested the LP -> LS transform on elliptic filters and it worked - although, for production code, one would certainly prefer the closed form formulas for the poles and zeros given by Orfanidis whenever possible. This procedure is needed only when there is no closed form formula available - such as is the case for Bessel filters (and also Papoulis, Halpern, Gaussian, etc.)
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post Reply

Return to “DSP and Plugin Development”