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

怎样用SS里的公式去真正推算EQ参数?

SigmaDSP & SigmaStudio DavidHuang Dec 4, 2018 00:00 1 replies Original on forum ↗
Subscribe
DavidHuang Question
Dec 4, 2018 00:00

想向ADI的工程师请教个问题。在上位机要通过MCU去设置EQ的参数,如下:

https://wiki.analog.com/resources/tools-software/sigmastudio/toolbox/filters/general2ndorder

或SigmalStudio的help 都有下面的公式:那么,我想请教,就这个例子而言,是如何利用下面的公式推算出来的呢?很希望能指教一下。谢谢你们的帮忙5633.SigmalStudio.zip

EQ Algorithm

The 2nd Order and medium-size EQ blocks use multiple biquad filters, based on Robert Bristow-Johnson's work as shown here:

Common Variables

A = 10^(boost/40)

ω0 = 2*pi*f0/Fs

alpha = sin(ω0)/(2*Q) (type: Peaking)

= sin(ω0)/2 * sqrt((A + 1/A)*(1/S - 1) + 2) (type: Shelving)

gainLinear = 10^(gain/20)

Peaking

Transfer function

Coefficients

a0 = 1 + alpha/A

a1 = -2 * cos(ω0)

a2 = 1 - alpha/A

b0 = (1 + alpha*A) * gainLinear

b1 = -(2 * cos(ω0)) * gainLinear

b2 = (1 - alpha*A) * gainLinear

Low-Shelf

Transfer function

Coefficients

a0 = (A+1) + (A-1)*cos(ω0) + 2*sqrt(A)*alpha

a1 = -2*( (A-1) + (A+1)*cos(ω0) )

a2 = (A+1) + (A-1)*cos(ω0) - 2*sqrt(A)*alpha

b0 = A*( (A+1) - (A-1)*cos(ω0) + 2*sqrt(A)*alpha ) * gainLinear

b1 = 2*A*( (A-1) - (A+1)*cos(ω0) ) * gainLinear

b2 = A*( (A+1) - (A-1)*cos(ω0) - 2*sqrt(A)*alpha ) * gainLinear

High-Shelf

Transfer function

Coefficients

a0 = (A+1) - (A-1)*cos(ω0) + 2*sqrt(A)*alpha

a1 = 2*( (A-1) - (A+1)*cos(ω0) )

a2 = (A+1) - (A-1)*cos(ω0) - 2*sqrt(A)*alpha

b0 = A*( (A+1) + (A-1)*cos(ω0) + 2*sqrt(A)*alpha ) * gainLinear

b1 = -2*A*( (A-1) + (A+1)*cos(ω0) ) * gainLinear

b2 = A*( (A+1) + (A-1)*cos(ω0) - 2*sqrt(A)*alpha ) * gainLinear

For each of these three filters, all the coefficients are divided by a0, normalizing them and making a0 = 1, so that only 5 coefficients must be stored.

In the implementation on the DSP, when the coefficients are stored in parameter RAM, a1 and a2 need to be inverted. This is done in software before the parameters are written to memory.

ff2e23c0fda00eec1bb3ec5f4a92aca.png
ff2e23c0fda00eec1bb3ec5f4a92aca.png
微信图片_20181205092244.png
微信图片_20181205092244.png
ADIApproved Reply
Dec 7, 2018 00:00

Hi, DavidHuang,

You should to see how the library EQ blocks work and how to use the Stimulus and Probe to look at the filter response, and how to use the Capture window to see the coefficients. This should help him see how a controller needs to be programmed.

And you should use safeload to update the coefficients at the same time to avoid noise. The following link is about safeload:

https://ez.analog.com/dsp/sigmadsp/w/documents/5182/implementing-safeload-writes-on-the-adau1701