Sie sind auf Seite 1von 5

Name: Yeounsoo Kim

ECE 3551 Microcomputer Systems 1


Lab # 04 Learn to process audio data

Partner: Mutasum, and Suctru


Performed date: 10/29/2007
Submitted date: 11/05/2007

1) Purpose of the Experiment

The purposes of this lab are learn to process audio data in ADSP-BF533
EZ-Kit Lite based on Lab3 with an Infinite Impulse Response filters function
as well as learn the process of implement digital iir filter in DSP, and finally we
apply and control the audio input/output with all the process.

2) Equipment Used

Equipments and program


- ADSP-BF 533 EZ-Kit Lite
- Visual DSP ++ 5.0

3) Procedure

First, we started with this project from Lab 3, and instead of using Matlab
calculation we used coefficients for LP filter and HP filter as given by instructor. And
adjust the coefficient to get right input/output function for all. In most case we had
worked with Process_data part.

4) Code (Process_data file)

#include "Talkthrough.h"
//Low Pass Filter IIR coeficients A and B arrays
float B0[5] = {0.2467697561, 1, 0.5122942924,1,1};
float B1[5] = {0, -0.8766128421, 0, 0.7790518402,1};
float B2[5] = {0, 1, 0, 1, 0};
float A0[5] = {1, 1, 1, 1, 1};
float A1[5] = {0, -1.07370162, 0, -0.4791774154, 0};
float A2[5] = {0, 0.6737909913, 0, 0.1368679255, 0};
//Low Pass Filter IIR Delays and output variable arrays
float de0[3]= {0,0,0};
float de1[3]= {0,0,0};
float de2[3]= {0,0,0};

//High Pass Filter IIR coeficients A and B arrays


float hpA0[3]= {1,1,1};
float hpA1[3]= {-0.8822702169,-1.878196359,-1.791189313};
float hpA2[3]= {0,0.9264635444,0.8174005151};
//High Pass Filter IIR Delays and output variable arrays
float hpB0[3] ={1,1,1};
float hpB1[3] ={-1,-1.965208292,-1.986638904};
float hpB2[3] ={0,1,1};

//High Pass Filter IIR Delays and output variable arrays


float hpd0[3] ={0};
float hpd1[3] ={0};
float hpd2[3] ={0};

//------------------------------------------------------------------------------------------------------------------//
// Function: Process_Data()

//

//

//

// Description: This function is called from inside the SPORT0 ISR every
//
//

time a complete audio frame has been received. The new

//

input samples can be found in the variables iChannel0LeftIn,

//

//
//

iChannel0RightIn, iChannel1LeftIn and iChannel1RightIn

//

//

respectively. The processed data should be stored in

//

//

iChannel0LeftOut, iChannel0RightOut, iChannel1LeftOut,

//

//

iChannel1RightOut, iChannel2LeftOut and

iChannel2RightOut

//
//

respectively.

//

//------------------------------------------------------------------------------------------------------------------//
void Process_Data(void)
{
iChannel0LeftOut = iChannel0LeftIn;
iChannel0RightOut = iChannel0RightIn;
iChannel1LeftOut = iChannel1LeftIn;
iChannel1RightOut = iChannel1RightIn;
}
//Low pass filter
void lowpassfilter(void)
{
float input = (float)(iChannel0LeftIn <<8);
int m;
for (m=0; m<=2; m++)
{
de0[m] = input - (A2[m]*de2[m]) - (A1[m]*de1[m]);
input = (B2[m]*de2[m]) + (B1[m]*de1[m]) + (B0[m]*de0[m]);
de2[m] = de1[m];
de1[m] = de0[m];
}
iChannel0LeftOut= ((int)input) >>8;
}
//High pass filter IIR function

void highpassfilter(void)
{
float HighPassx = (float)(iChannel0RightIn <<8);
int m;
for(m=0; m<=2; m++)
{
hpd0[m] = HighPassx - (hpA1[m] * hpd1[m]) - (hpA2[m] * hpd2[m]);

HighPassx = (hpB2[m] * hpd2[m]) + (hpB1[m] * hpd1[m]) + (hpB0[m] *


hpd0[m]);
hpd2[m] = hpd1[m];
hpd1[m] = hpd0[m];
}
iChannel0RightOut=((int)HighPassx) >>8;
}

5) Discussion
While we perform this experiment we had a difficulty to adjust a LP/HP filter
since we did not get right output. And finally we decided to use three coefficients
instead of using five. Through this experiment it was a helpful to understand the
function of input / output most of all as well as learned about filtering.

Das könnte Ihnen auch gefallen