I've been developing a music player for Android for many years, and I've recently started working on the implementation of a parametric equalizer.

I'm having trouble preventing a gain at one band from adversely affecting the gain at a neighbouring band, resulting in a peak gain higher than desired, which ultimately may result in clipping.

I've been following the Orfanidis paper on 'Digital Parametric Equalizer Design With Prescribed Nyquist-Frequency Gain' as well as an example Matlab implementation of some of the concepts outlined in the Orfanidis paper.

The equalizer effectively acts as a graphic eq - I've fixed the center frequencies and bandwidths to specific values:

(Values in Hz, Bandwidth in brackets)

  • 63 (15)
  • 125 (30)
  • 250 (30)
  • 400 (45)
  • 630 (75)
  • 1000 (115)
  • 1600 (180)
  • 2500 (290)
  • 4000 (460)
  • 6300 (730)
  • 10000 (115)
  • 16000 (1825)

The plan is to allow a maximum boost/cut of 12dB, with bandwidth gain set to 3dB below peak. Ideally, I could first apply a 12dB cut across the entire spectrum, so that a peak boost of 12dB is guaranteed not to cause any clipping.

The problem is, if a user applies a boost of 12dB at, say, center frequencies 63Hz and 125Hz, the peak gain at both frequencies ends up being more than 12dB, which may result in clipping. Here's what the FFT looks like for that case:


Notice the peak gain is actually greater than 12dB.

The effect is compounded if a boost is applied across all the frequencies mentioned above (this is the worst case scenario):


Notice the peak gain is more like 15dB.

Maybe I should expect this, and the answer is simply that bands shouldn't be spaced too closely if applying a lot of gain. But, my problem is I'm trying to provide this functionality to a casual music listener, but I don't want them to configure the equalizer in such a way that clipping occurs, as they'll likely claim that it's faulty.

So my questions are - does this look like a correct implementation of a parametric eq? Does it make sense that neighbouring bands can have a greater peak gain than the specified 'boost gain'? How can I prevent a user from causing clipping in this situation?

Any help is appreciated.

  • $\begingroup$ I'm not an audio designer so don't want to answer with confidence; but I'm rather surprised the filters for each band are as they are (they appear to be 2nd order biquad resonators) that would as you are experiencing, not roll-off significantly so as to affect your adject bands. Have you considered modifying your center frequencies such that they are all integer multiplies and then use an FFT approach to modify the gain in each? I have no confidence that this would apply but do see that all the other bands would be in the nulls of the FFT response for any given band. $\endgroup$ – Dan Boschen Nov 29 '19 at 2:46
  • $\begingroup$ Plus when you turned all the bands to full scale, the result would add uniformly across the entire band rather than have the excessive ripple you show. Just a thought. $\endgroup$ – Dan Boschen Nov 29 '19 at 2:47
  • $\begingroup$ Thanks for the discussion. I don't quite understand what you're suggesting here. What do you mean by 'integer multiples', and what is an 'FFT approach'? Are you saying that you would derive the gain from a predefined FFT, rather than the other way around? $\endgroup$ – Tim Malseed Nov 29 '19 at 5:26
  • $\begingroup$ The FFT is essentially a bank of filters, each with a Sinc function as the frequency response, and each frequency is an integer multiple of the first. The nulls of each "bank" are in the peaks of all the other banks, so if you increase one it will minimally impact the others. So I was considering taking an FFT, adjusting your gains and the IFFT block by block in an overlap-app approach. $\endgroup$ – Dan Boschen Nov 29 '19 at 12:49
  • $\begingroup$ Although I see Fat32 mentioned @RobertBristowJohnson -- you want to get his attention as he works directly with this application so I suspect he will have the best suggestion for you; and comment on the merits and deficiencies of what I am thinking. $\endgroup$ – Dan Boschen Nov 29 '19 at 12:50

There's no universally acclaimed correct design of equalizers. Just like there are multiple car designs per brand, there are also multiple techniques for achieving desired effects.

It's true that your channel filters will interact with each other and change the effective resulting gain at each frequency, but mostly pronounced at the adjacent channel peak though.

The amount of interaction depends on your selected DC gains (which are unity for your application) and channel bandwidths and bandwidth gains.

There are recommended practices to prevent distortion levels. Headrooms are included so that peak gains will not create clipping. Or you can allow some...?

Robert Bristow Johnson is a member here and he's one of the designers of those (cookbook) parametric equalizers that you want to use in your application.

| improve this answer | |
  • $\begingroup$ Thanks for your response. Can you tell me what it means to have 'unity' DC gains? Also, I believe that by attenuating the entire spectrum by 15dB, I am creating that 'headroom', is that correct? I'm assuming that an average listener's music is normalised such that it wouldn't take much gain in the wrong frequency range to cause distortion. Could you point me in the direction of some of those recommended practices to prevent distortion? $\endgroup$ – Tim Malseed Nov 29 '19 at 5:20
  • $\begingroup$ These are impossible to solve issues... The only resolution is the proper headroom assignment. Think of your worst case and choose a strategy. Also simultaneously think of your typical listening case and choose the best possible output as well. Some adaptive strategies can help but they will have computational as well as programmatic complexities... $\endgroup$ – Fat32 Nov 29 '19 at 17:47
  • $\begingroup$ when you call the parametric equalizer design function (that comes with Orfanidis document) there's a DC gain parameter too. It seems you have set it to unity gain (or zero dB). $\endgroup$ – Fat32 Nov 29 '19 at 17:50

This looks like a graphic equalizer to me, not parametric, because the filter parameters are fixed. Changing your terminology might give you better results from a search engine.

It also looks like you are running your filters in series, which would make sense for a true parametric EQ. Something I’ve done in the past is run parallel filters and sum them together for graphic EQ. As I recall, this allowed for the filters to ‘interfere’ with each other such that the overall gain didn’t overshoot, but it wasn’t perfect. Basically, you would run your signal through a bunch of bandpass filters, scale the outputs by a level control and sum them all with the original signal. If your scaling factor for a band is positive it will boost that band, negative will cut and zero will leave it unchanged.

There are a lot of different ways to solve this problem, and the ‘secret sauce’ will be what differentiates your implementation from someone else’s. The most I think you could hope for on this forum is some new ideas to try, which hopefully I’ve provided. Cheers.

Edit: I found this a while back and it has a lot of good ideas. https://res.mdpi.com/d_attachment/applsci/applsci-06-00129/article_deploy/applsci-06-00129.pdf

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.