ΣSigmaStudio Ask AI Русский Log in

How can i get or caculate the parameter "S" from the given 4 parameters "Q, gain, boost, f0/fs" for shelving iir filter in the sigmasudio based on adau1701?

SigmaDSP & SigmaStudio shihong sun Jun 5, 2020 00:00 3 replies Original on forum ↗
Subscribe
shihong sun Question
Jun 5, 2020 00:00

The image above shows that the filter 6 have 4 given parameters, "fc/fs, Q_factor, gain, boost". To get the coefficients-- "a1,a2, b0,b1,b2", there is a templet in the literature "1st-2nd-Order_IIR_Coefficient_Calculator" about highShelf and lowShelf filter, like this:

Now, the original 4 given parameters become 5 control values. "S" is one and a new member, the original "Q" becoming a intermediate value derived from S and A.

My question focus on two:

1. Is the intermediate value “Q” the same as the original "Q" which is one of the 4 given parameter.

2. where is the value "S" coming from? Because there is no such parameter among the original 4 given parameters. HOW CAN I GET IT?

The value "S" is most important I think, it decides all the 5 coefficients in the following algorithm. In the literature "Cookbook formulae for audio EQ biquad filter coefficients", there is a

equation about "S" and" Q":

1/Q = sqrt((A + 1/A)*(1/S - 1) + 2); (1)
And in the literature "1st-2nd-Order_IIR_Coefficient_Calculator" , the equation is somewhat different:

1/Q = sqrt((A + 1/A)^(1/S - 1) + 2); (2)
I don't know which one is correct! pls tell me which one I should choose.
The key point is how can i get "S" first. I have tried many ways to get this "S" , but all failed. For example, I tried to get "S" from equation (1) or (2) ,
assuming the intermediate value "Q"is the original given parameter "Q". However the result made me frustrated. Maybe the reason is because the "Q" here is totally
different from the original given one.
In one word, how can I get "S" from the given 4 parameters "Q", "fc/fs", "boost", and "gain". Please give me the detailed algorithm.

Thanks a lot!

Shihong Sun.

Audio Signal Processors

SigmaDSP Audio Processors

adau1701

cut.jpg
cut.jpg
template_cut.jpg
template_cut.jpg
KJBob Reply
Jun 6, 2020 00:00

Thank you for bringing this to my attention. My bad in misunderstanding the shelf filter. The correct formula to get Q from S is the one with the multiplication, not the exponentiation. Not sure how I managed to goof. From Cookbook formulae for audio EQ

The error in my previous calculation has little effect on shelf filters using mild slopes, but becomes pronounced as S increases. It also severely complicates trying to reverse calculate S from Q -- this results in taking the log of a negative number for any reasonable value of Q. At that point I had to start from scratch and find out what was wrong.

The corrected spreadsheet is attached below. It also includes the reverse calculation of S from Q:

S = (Ax + 1/Ax) / (Ax + 1/Ax + (1/Q^2) -2)

Best regards,

Bob

1781.1st-2nd-Order_IIR_Coefficient_Calc.zip

shihong sun Reply
Jun 7, 2020 00:00

Thank you Mr.Bob for your prompt and detailed reply.

According to the new version algorithm template --"1781.1st-2nd-Order_IIR_Coefficient_Calc.zip"that you you gave to me, I have 2 questions to disguss with you.

1. Only A1, and A2 are devided by a0 in the excel template, the B0, B1, and b2 are't devided by a0 instead. Why?

As we know, for normalizing, all the coefficients should be divided by a0, including B0, B1, B2. But here not.

2. I noticed that A1, and A2 are not inverted here, does it mean i should inverted them before I feed them to adsp 21489 ?

Thanks !

Shihong Sun from Shenzhen, China.

DaveThib Reply
Jun 10, 2020 00:00

Hello shihong Sun,

I think one of the issues here is that you are posting on the SigmaDSP section of the forum but you are using the SHARC 21489 processor. Some things are done differently on the SigmaDSP so you need to be asking these questions on the SHARC space of the forum.

https://ez.analog.com/dsp/sharc-processors

Thanks,

Dave T