Digital Signal Processing Reference
In-Depth Information
Coefficients b[3]
Coefficents a[3]
b[0]
b[1]
b[2]
0.5
a[0]
a[1]
a[2]
1
0.4
-0.6
0.7
-0.5
Update of input
buffer x[3]
(FIFO)
Update of output
buffer y[3]
(FIFO)
New input x(n)
x[0]
x[1]
x[2]
x(n)
x(n-1)
x(n-2)
Free for new sample
y[0]
y[1]
y[2]
y(n)
y(n-1)
y(n-2)
Free for output sample
First step
First step
Kicked out
Kicked out
float x[3]={0.0, 0.0, 0.0};
float b[3]={0.5, 0.7, -0.5};
float a[3]={1, 0.4, -0.6};
float y[3]={0.0, 0.0, 0.0};
interrupt void c_int11()
{
float lc; /*left channel input */
float rc; /*right channel input */
float lcnew; /*left channel output */
float rcnew; /*right channel output */
int i;
//Left channel and right channel inputs
AIC23_data.combo=input_sample();
lc=(float) (AIC23_data.channel[LEFT]);
rc= (float) (AIC23_data.channel[RIGHT]);
// Insert DSP algorithm below
for(i=2; i>0; i--)
/
Update the input buffer
/
{ x[i]=x[i-1]; }
x[0]= lc; /
Input from the left channel
/
for (i=2;i>0;i--)
/
Update the output buffer
/
{ y[i]=y[i-1]; }
y[0]=b[0] x[0]+b[1] x[1]+b[2] x[2]-a[1] y[1]-a[2] y[2];
// End of the DSP algorithm
rcnew=y[0];
rcnew=y[0];
AIC23_data.channel[LEFT]=(short) lcnew;
AIC23_data.channel[RIGHT]=(short) rcnew;
output_sample(AIC23_data.combo);
}
FIGURE 9.26
Example of IIR filtering using linear buffer update.
 
Search WWH ::




Custom Search