Digital Signal Processing Reference
In-Depth Information
We define the numerator coefficient buffer b[2], the denominator coefficient buffer a[3], the input
buffer x[2], and the output buffer y[3] in Figure 9.27 , which also shows the modified implementation
for tone generation.
Coefficients b[2]
Coefficents a[3]
b[0]
b[1]
0.0
0.587785
a[0]
a[1]
a[2]
1.0
-1.618034
1.0
Update of input
buffer x[2]
(FIFO)
Update of output
buffer y[3]
(FIFO)
New input x(n)=0
x[0]
x[1]
5000
x(n-1)
Free for new sample
y[0]
y[1]
y[2]
y(n)
y(n-1)
y(n-2)
Free for output sample
First step
Kicked out
First step
Kicked out
float x[2]={5000, 0.0}; / initialize the impulse input /
float b[2]={0.0, 0.587785};
float a[3]={1.0, -1.618034, 1.0};
float y[3]={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
y[0]=b[0] x[0]+b[1] x[1]+b[2] x[2]-a[1] y[1]-a[2] y[2];
for(i=2; i>0; i--) / Update the input buffer with zero input /
{ x[i]=x[i-1]; }
x[0]= 0;
for (i=2;i>0;i--) / Update the output buffer /
{ y[i]=y[i-1]; }
// 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.27
Example of IIR filtering using linear buffer update and the impulse sequence input.
 
Search WWH ::




Custom Search