AnsweredAssumed Answered

Problem generating filter coefficients

Question asked by MagicRuB on Feb 9, 2011
Latest reply on Feb 10, 2011 by BrettG

Using Method 1 from http://ez.analog.com/message/5485 but on a 2nd order HighPass on an ADAU1442

 

I'm having trouble generating the coefficients for the 2nd order HPF algorithms, they don't match what I see in the Capture window and they mess the audio up when I implement them. Does anyone see what I'm doing wrong?

 

// 2nd Order High-Pass filter

HPFcutoff = 20; // Hz

gain = 1; // unity

Q = 0.53;

 

#define MyPI 3.14159265359

w0 = 2.0 * MyPI * (float)HPFcutoff / 48000.0; // 2*pi*f0/Fs

alpha = sin(w0)/(2.0*Q);

a1 = -2.0 * cos(w0);

a2 = 1 - alpha;

b0 = (1 + cos(w0)) * (gain / 2);

b1 =- (1 + cos(w0)) * (gain);

b2 = (1 + cos(w0)) * (gain / 2);

 

calculated by uP (and confirmed via Ti-89) as:

w0 = 0.0026179

alpha = 0.0024598

a1 = -1.9999932

a2 = 0.9975301

b0 = 0.9999982

b1 = -1.9999964

b2 = 0.99999982

 

 

 

Working example: Sigma Studio output seen in Caputure Window after pressing enable button:

Param Value:  0.997534513473511 (labled as b0)?
Param Value:  -1.99506914615631 (labled as b1?)
Param Value:  0.997534513473511 (labled as b2?)
Param Value:  1.99506568908691 (labled as a1?)
Param Value:  -0.995072603225708 (labled as a2?)

Outcomes