Post Go back to editing

EQ Low- and High-Shelf filter coefficients comming back - Mysterious S factor.

Hi everybody

I have to calculate EQ coefficients before start my ADAU1701 every time. The first filter in EQ is LowShelf filter and last one - High-Shelf. Rest are peaking filters. There are some threads on this forum about calculation of EQ filter coefficients, but only about EQ peaking filter. I found new problem: mysterious S factor in EQ shelving filters.

I thought the S factor means "Slope" parameter of Low- or High-Shelf filter. Slope can vary from 0 to 2 in graphics editor. But there is not Slope in FilterTableGen. There is Q parameter, which can vary from 0,01 to 20.

I detected the problem when I started to change the parameter S in excel -> argument of sqrt function sometimes is going under the 0.

For ex.:

Boost = 5dB; S=1,7

Boost = -5dB; S=0,7

Does somebody knows what t. h. is S? And how to mold the curve of the shelving filter using coefficients?

There is well known excel file: Parameteric_EQ_IIR_Coefficient_Calculator.xls with calculations, but only for peaking filter type of EQ filter. Maybe someone could expand on the functions of shelving filters.

I

attachments.zip
•      Hello,

The slope factor S is related to Q in a direct but nonlinear way described in Robert Robert Bristow-Johnson's work.  One reference to it is here:  http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

Bi-quad coefficients given there are for the Direct Form I topology.   SigmaDSPs use Direct Form II, which appears to fold the a0 coefficient into the others.

The SigmaStudio toolbox wiki at:  General 2nd Order [Analog Devices Wiki]

provides the coefficient calculations used by all Sigma bi-quad filters.  The Parametric EQ formulas in Brett G's famous spreadsheet agree with those in the wiki, so it seemed easy enough to extend the spreadsheet for shelving filters.  I tried doing this today, it felt like I was painting over a Picasso.  The shelving calculations are quite complex, and the resulting filter's response varies wildly with tiny coefficient variations.  My coefficients produced a grotesque result -- and I've yet to uncover my error(s).

Best regards,

Bob

I have the spreadsheet working now -- it calculates IRR coefficients for all three filters commonly found in parametric EQs:  Peaking, Low Shelf, and High Shelf.

Best regards,

Bob

ParaShelf_EQ_IIR_Coefficient_Calculator.xls
• Great job, thanx a lot.

So there is a mistake in Sigmastudio help and Audio-EQ-Cookbook.txt. Multiplying instead of exponentiation.

• Hi all:

SigmaStudio does not use Direct Form 2, it uses Direct Form 1, it's just that there is an assembly code minus in front of some of the denominator coefficients of the filter. This is due to the possibility of the SigmaDSP hardware to do a minus in hardware. In other words, it's a simple implementation difference between different ways in the way the Direct Form 1 can be implemented on the SigmaDSP. Direct Form1 is the correct way of doing audio filtering in fixed point hardware to avoid quantization problems.

Regards

Miguel

•      Hi Miguel,

Did this change since JeradL's post from the year 2010  (below)?  Or does it differ among different cores / compilers?

https://ez.analog.com/message/16011#16011

Best regards,

Bob

• Note for all,

The link that is in this post for the Audio EQ Cookbook is no longer a valid link. This new link should have the info that was in the old link:

http://shepazu.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html

Dave T

• Hello Bob,

I just fixed JaredL's response on that old post to correct it. It was incorrect. The filters are Direct Form 1

Dave T

• Thanks, Dave for fixing the Cookbook link as well as the filter topology issue.  Now thanks to 's inquiry here, I found an error in my shelf-filter coefficient calculations,   The error causes a Q lower than expected, which matters mostly for slope >1. The corrected spreadsheet is below.

Best regards,

Bob

1st-2nd-Order_IIR_Coefficient_Calc.zip

• Awesome work Bob!

You really are good at this digital filtering. :)

Dave T