Variable Peak/Bell or Shelf Slopes in EQ

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

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! 8)
You do not have the required permissions to view the files attached to this post.

Post

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 higher-order 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 7:37 pm, edited 1 time in total.
My audio DSP blog: earlevel.com

Post

Steepness versus sharpness of corners is all about the number of poles and zeros. For instance, a 2-pole 2-zero (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.
My audio DSP blog: earlevel.com

Post

earlevel wrote:Steepness versus sharpness of corners is all about the number of poles and zeros.
Well, there's a bit more than that into it, since higher order filters have more degrees of freedom.

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 all-pole low-pass filter (eg. Bessel, Butterworth, whatever) of order N, you can convert it to a low/high-shelf (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 log-frequency 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 high-shelf first, if you want it to be symmetric with the low-shelf. [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 band-shelf (ie. "peaking" or "bell") similarly, you take the Nth order low-pass and apply band-pass 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 band-pass filter of order 2*N, where the "bandpass Q" of the transform sets the band-width. Even though some sources suggest doing this only for "narrow" bandwidth filters, it works perfectly fine for wide ones too [and using band-pass 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 band-shelf 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 slope-steepness, then you can use the same parameter to do the same with these]

Now... the specific band-shelving filter in the picture looks to have fairly "sharp edges" so it's probably built out of a Butterworth-prototype. If you did the same with eg. Bessel filter, you'd get more of a bell shape, but sort-of "fatter" than a 2nd order bell... but really you can use pretty much any low-pass to get whatever edge shape you want.

Unfortunately none of this will answer the question of how to actually pick a suitable low-pass 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 11:17 pm, edited 1 time in total.

Post

mystran wrote:
earlevel wrote:Steepness versus sharpness of corners is all about the number of poles and zeros.
Well, there's a bit more than that into it, since higher order filters have more degrees of freedom.
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.

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 well-known filter structures, as well as manipulating poles and zeros directly. It's pretty apparent what your typical filter plug-in 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 band-shelf and wonder how to replicate it with a biquad if you understand poles and zeros.
My audio DSP blog: earlevel.com

Post

earlevel wrote:
mystran wrote:
earlevel wrote:Steepness versus sharpness of corners is all about the number of poles and zeros.
Well, there's a bit more than that into it, since higher order filters have more degrees of freedom.
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.
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. :)

Post

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.
I totally get that (after I got past the first sentence :wink: ), didn't mean to sound defensive, it just gave me the opportunity to elaborate.

It kind of makes me want to do a new filter explorer tool for my website (as if I had the time :lol: ). 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/iir-explorer.asp
My audio DSP blog: earlevel.com

Post

The simplest way to do this is start with a 2-pole variable-slope low shelf EQ. Those are described in RBJ cookbook or in "The Art of VA Filter design". To turn it into a band-shelf, use LP to BP transform, as mystran suggested.

To do a higher-order thing you might try the following. Write your 2-pole high-shelf as a ratio of 2 two-pole lowpasses (if you need a low-shelf, 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 unit-cutoff one. Then take a unit-cutoff 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 2-pole unit-cutoff lowpass. Now (regardless of R), multiply all pole radii by wc^(1/N). So you transform each of your 2-pole lowpasses as described and take their ratio again. This will give you an N times steeper high-shelf with a unit cutoff. At some value of R your N-th order shelf will also become identical with the N/2-th order shelf (this is the same value where e.g. 2-pole shelf is identical to 1-pole), which allows the slope variation to be "chained".

To make a low-shelf, multiply by the respective gain. To make a band-shelf 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 Thu May 31, 2018 6:32 am, edited 1 time in total.

Post


Post

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). :)

Post

Is there a good freeware or cheap VST that has this feature?

Post Reply

Return to “DSP and Plugin Development”