# Re: EQ Algorithm, Low  shelf wrong!

Discussion created by michaelc21 on Jan 28, 2010
Latest reply on Feb 4, 2010 by sanjaac
Branched from an earlier discussion

These days I go back to the  ADI dsp project again.

I use the calculate  coefficent method.

Good news is that,  I am right  to calculate  the  PEQ's  coefficent.

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)

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

But the  Low shelf  and  Hight shelf  doesn't  right.

For Low shelf , I use  these  formulas:

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

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

When calculate the "alpha", I see there is an 'S', I thought it is shelf "slope", right?

Then , I use the formula above the calculate the 5 coeffient, but it is much defferent from

what I saw in the capture window.

I use vc++6.0 to test all the calculating, the appatch is the code file,and project of Sigma .

Urgency!

Thank you!