Variable Peak/Bell or Shelf Slopes in EQ

arwejem
 KVRer
 2 posts since 22 Apr, 2015
Variable Peak/Bell or Shelf Slopes in EQ
Hi there,
How do I design bell shapes with variable slope or steepness (and not only the q factor)? Can I find information or example code somewhere? You find this kind of features in some of the modern eq plugins like Fabfilter or this Crave dsp. Thank you!
How do I design bell shapes with variable slope or steepness (and not only the q factor)? Can I find information or example code somewhere? You find this kind of features in some of the modern eq plugins like Fabfilter or this Crave dsp. Thank you!
You do not have the required permissions to view the files attached to this post.

earlevel
 KVRist
 474 posts since 4 Apr, 2010
Re: Variable Peak/Bell or Shelf Slopes in EQ
I don't know these particular products, but the image appears to be a chain of simple filters, individually settable—typical of EQ plugins.
For instance, in your screenshot, there's a resonant higherorder highpass, then a "band shelf" in the middle (essentially a pair of complementary shelf filters), a notch filter to the right, a wide (low Q) bandpass of something on the high end...
Basically, features in the response require some combination of poles and zeros—the more features, the more poles and/or zeros. While a product could manipulate them directly for arbitrary shapes, usually the GUI just lets the user manipulate multiple simpler filters, because people are used to how the simpler filter (highpass, lowpass, bandpass, shelf...) work.
For instance, in your screenshot, there's a resonant higherorder highpass, then a "band shelf" in the middle (essentially a pair of complementary shelf filters), a notch filter to the right, a wide (low Q) bandpass of something on the high end...
Basically, features in the response require some combination of poles and zeros—the more features, the more poles and/or zeros. While a product could manipulate them directly for arbitrary shapes, usually the GUI just lets the user manipulate multiple simpler filters, because people are used to how the simpler filter (highpass, lowpass, bandpass, shelf...) work.
Last edited by earlevel on Wed May 30, 2018 11:37 am, edited 1 time in total.
My audio DSP blog: earlevel.com

earlevel
 KVRist
 474 posts since 4 Apr, 2010
Re: Variable Peak/Bell or Shelf Slopes in EQ
Steepness versus sharpness of corners is all about the number of poles and zeros. For instance, a 2pole 2zero (biquad) filter has limits. The more poles and zeros you have, and the more control you exercise over where the are placed, the more variations you can have. Typically, things get unwieldy for the user, you you have to decide whether the user gets complete control (can draw an arbitrary response, for instance) and you use smarts to try to get as close are you can, or whether you supply multiple simple filters. The latter is almost always the best approach because you'll always be able to supply exactly when the user is able to request, and, more importantly, people usually work in multiple simple features. For instance, I need to suppress this resonance at 500 Hz, decrease the boomy bass below 80 Hz, half up some "air" above 10 kHz...
Typically, you'll want steepness control on the highpass and lowpass, by letting the user choose higher order filters. Steepness is less useful for peaking filters and shelves—they just sound less musical, and if you really need to be that surgical, something was probably terribly wrong in the recording.
Typically, you'll want steepness control on the highpass and lowpass, by letting the user choose higher order filters. Steepness is less useful for peaking filters and shelves—they just sound less musical, and if you really need to be that surgical, something was probably terribly wrong in the recording.
My audio DSP blog: earlevel.com

mystran
 KVRAF
 4983 posts since 12 Feb, 2006 from Helsinki, Finland
Re: Variable Peak/Bell or Shelf Slopes in EQ
Well, there's a bit more than that into it, since higher order filters have more degrees of freedom.earlevel wrote:Steepness versus sharpness of corners is all about the number of poles and zeros.
In general (and in terms of analog design, because you really don't want to try to do this directly in digital), if you take an allpole lowpass filter (eg. Bessel, Butterworth, whatever) of order N, you can convert it to a low/highshelf (which are mathematically the same except for the DC gain) of order N, by making the zeroes a copy of the poles and then moving the poles and zeroes in the opposite directions on the logfrequency scale (ie. take Nth root of the square root of the desired gain as a linear value and multiply/divide the pole/zero frequencies with that value). For filters such as Bessel with poles not all on the cutoff frequency, you might (or might not) want to reflect the poles around the cutoff frequency for highshelf first, if you want it to be symmetric with the lowshelf. [not sure if I ever tried such shelves, so YMMV; note that you probably want a filter design where you can adjust the "Q" as well, in order to control the width of the shelf]
For bandshelf (ie. "peaking" or "bell") similarly, you take the Nth order lowpass and apply bandpass transform (look it up on Google; it's a bit complicated so I won't try to explain it because the chance that I'll get the details wrong is too high) to convert it into a bandpass filter of order 2*N, where the "bandpass Q" of the transform sets the bandwidth. Even though some sources suggest doing this only for "narrow" bandwidth filters, it works perfectly fine for wide ones too [and using bandpass transform will always give you the actual desired gain at the middle of the band, where as using "two shelves" is somewhat approximate and the error gets worse as the bandwidth gets more narrow]. Then to convert the bandpass filter into a bandshelf you again duplicate the poles as zeroes, but this time you adjust the Q values of the poles/zeroes up/down (again multiply/divide by a constant). [if you had a prototype for the shelves where you can adjust the "Q" to control the slopesteepness, then you can use the same parameter to do the same with these]
Now... the specific bandshelving filter in the picture looks to have fairly "sharp edges" so it's probably built out of a Butterworthprototype. If you did the same with eg. Bessel filter, you'd get more of a bell shape, but sortof "fatter" than a 2nd order bell... but really you can use pretty much any lowpass to get whatever edge shape you want.
Unfortunately none of this will answer the question of how to actually pick a suitable lowpass prototype to get the desired edge shape... and frankly that's an interesting question that probably doesn't really have a "correct" approach unless you want maximally steep edges (in which case use Butterworth).
Last edited by mystran on Wed May 30, 2018 3:17 pm, edited 1 time in total.
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

earlevel
 KVRist
 474 posts since 4 Apr, 2010
Re: Variable Peak/Bell or Shelf Slopes in EQ
Well, I didn't mean "all" in the sense of being exclusive of other variables. I meant you aren't going to "get there" if you don't have enough poles and zeros to place.mystran wrote:Well, there's a bit more than that into it, since higher order filters have more degrees of freedom.earlevel wrote:Steepness versus sharpness of corners is all about the number of poles and zeros.
To be clear, by poles and zeros I didn't mean 2nd order butterworth lowpass vs 3rd, etc (I would have said "filter order" in that case). I meant if you have, say, two poles and two zeros, there is only so much you can do—in particular the OP asked about about "bell shapes with variable slope or steepness (and not only the q factor)". That is, you're not going to get there with a biquad, you need more poles and zeros. Placing them is another issue.
But I'm guessing the OP hasn't spent a lot of time manipulating basic wellknown filter structures, as well as manipulating poles and zeros directly. It's pretty apparent what your typical filter plugin does if you're comfortable with basic filters and how poles and zeros affect response. For instance, you're not going to look at that bandshelf and wonder how to replicate it with a biquad if you understand poles and zeros.
My audio DSP blog: earlevel.com

mystran
 KVRAF
 4983 posts since 12 Feb, 2006 from Helsinki, Finland
Re: Variable Peak/Bell or Shelf Slopes in EQ
Oh, I want to make this clear: I have a bad habit of just quoting random things even if I'm not really trying to aim it at the person I'm quoting. It's not like I really doubt your ability to design filters, just wanted to share my thoughts for OPs benefit.earlevel wrote:Well, I didn't mean "all" in the sense of being exclusive of other variables. I meant you aren't going to "get there" if you don't have enough poles and zeros to place.mystran wrote:Well, there's a bit more than that into it, since higher order filters have more degrees of freedom.earlevel wrote:Steepness versus sharpness of corners is all about the number of poles and zeros.
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

earlevel
 KVRist
 474 posts since 4 Apr, 2010
Re: Variable Peak/Bell or Shelf Slopes in EQ
I totally get that (after I got past the first sentence ), didn't mean to sound defensive, it just gave me the opportunity to elaborate.mystran wrote:Oh, I want to make this clear: I have a bad habit of just quoting random things even if I'm not really trying to aim it at the person I'm quoting.
It kind of makes me want to do a new filter explorer tool for my website (as if I had the time ). This one is very nice, except that the filter types are more engineering oriented and not so much audio favorites (Butterworth lowpass, but not a similar lowpass with Q, no shelf...). But it may help the OP understand the "band shelf" versus "bandpass" at least. Note that for bandpass, the "order" is relative—an order "1" bandpass is a 2nd order filter (because you can't make a bandpass out of a 1st order filter). So, order 2 Butterworth bandpass (4 poles/zeros) gives you a flat shelf that order 1 can't:
http://jaggedplanet.com/iir/iirexplorer.asp
My audio DSP blog: earlevel.com

Z1202
 KVRian
 958 posts since 12 Apr, 2002
Re: Variable Peak/Bell or Shelf Slopes in EQ
The simplest way to do this is start with a 2pole variableslope low shelf EQ. Those are described in RBJ cookbook or in "The Art of VA Filter design". To turn it into a bandshelf, use LP to BP transform, as mystran suggested.
To do a higherorder thing you might try the following. Write your 2pole highshelf as a ratio of 2 twopole lowpasses (if you need a lowshelf, it just differs by a gain, which you then apply separately). Now we transform each lowpass independently. Let wc be its cutoff and R be its damping factor. Turn the lowpass into a unitcutoff one. Then take a unitcutoff Butterworth of order N and duplicate all its poles. Now, if R<1 turn one duplicated set of the poles by alpha/N and the other set by alpha/N, where alpha=arccos(R). Otherwise, if R>1, increase the radius of one duplicated set by the factor wc1^(1/N) and of the other set by wc1^(1/N), where wc1 is the radius of one of the poles of your 2pole unitcutoff lowpass. Now (regardless of R), multiply all pole radii by wc^(1/N). So you transform each of your 2pole lowpasses as described and take their ratio again. This will give you an N times steeper highshelf with a unit cutoff. At some value of R your Nth order shelf will also become identical with the N/2th order shelf (this is the same value where e.g. 2pole shelf is identical to 1pole), which allows the slope variation to be "chained".
To make a lowshelf, multiply by the respective gain. To make a bandshelf apply LP to BP transform.
Another option is to use elliptic approach, where you need to take a ratio of two elliptic lowpasses with the same cutoff and selectivity factors, but kind of opposite balances of passband and stopband ripple amplitudes. The zeros will cancel each other (since the selectivity is identical). You can trade the ripple amplitudes against the slope steepness by varying the selectivity factor.
As it's too much typing to explain all details, maybe you can wait a few weeks, I have a newer revision of my book in preparation, where it is explained in detail. Also as I wrote the above off the top of my head there may be some mistakes in the details as well. While I did try the Butterworth approach in practice, I didn't really try the elliptic approach (just plotting the amplitude response), but I expect it to work as well.
To do a higherorder thing you might try the following. Write your 2pole highshelf as a ratio of 2 twopole lowpasses (if you need a lowshelf, it just differs by a gain, which you then apply separately). Now we transform each lowpass independently. Let wc be its cutoff and R be its damping factor. Turn the lowpass into a unitcutoff one. Then take a unitcutoff Butterworth of order N and duplicate all its poles. Now, if R<1 turn one duplicated set of the poles by alpha/N and the other set by alpha/N, where alpha=arccos(R). Otherwise, if R>1, increase the radius of one duplicated set by the factor wc1^(1/N) and of the other set by wc1^(1/N), where wc1 is the radius of one of the poles of your 2pole unitcutoff lowpass. Now (regardless of R), multiply all pole radii by wc^(1/N). So you transform each of your 2pole lowpasses as described and take their ratio again. This will give you an N times steeper highshelf with a unit cutoff. At some value of R your Nth order shelf will also become identical with the N/2th order shelf (this is the same value where e.g. 2pole shelf is identical to 1pole), which allows the slope variation to be "chained".
To make a lowshelf, multiply by the respective gain. To make a bandshelf apply LP to BP transform.
Another option is to use elliptic approach, where you need to take a ratio of two elliptic lowpasses with the same cutoff and selectivity factors, but kind of opposite balances of passband and stopband ripple amplitudes. The zeros will cancel each other (since the selectivity is identical). You can trade the ripple amplitudes against the slope steepness by varying the selectivity factor.
As it's too much typing to explain all details, maybe you can wait a few weeks, I have a newer revision of my book in preparation, where it is explained in detail. Also as I wrote the above off the top of my head there may be some mistakes in the details as well. While I did try the Butterworth approach in practice, I didn't really try the elliptic approach (just plotting the amplitude response), but I expect it to work as well.
Last edited by Z1202 on Wed May 30, 2018 10:32 pm, edited 1 time in total.

juha_p
 KVRist
 480 posts since 21 Feb, 2006 from FI

arwejem
 KVRer
 2 posts since 22 Apr, 2015
Re: Variable Peak/Bell or Shelf Slopes in EQ
Thanks guys! Excellent answers. You're deep in this stuff!! I'm not that good in dsp math (though I know something) but these really help me to discover more about it. And yeah, to be clear, I was talking about the band shelf type (in the middle of the image).