View
212
Download
0
Category
Preview:
Citation preview
Basic Audio Manipulation
ByHaitham Alogbi
Instructor: Dr.Kepuska
ECE3551 - Microcomputer System 1
Purpose
To use the blackfin processor BF-533 to implement what we have learned about the blackfin processor. My approach for this project by :
• Input Audio will play throw 4 speakers and all LEDs will be turned off.
• PF8(once) : activate the IIR low pass filter , LED: 4 turn on(twice) : activate the FIR low pass filter. LED :4, 5 turn on
• PF9 (once) : activate the IIR High pass filter. LED :4,5,6,7 turn on (twice) : activate the FIR High pass filter. LED:4,5,6,7,8,9 turn on
• PF10: Activate / Deactivate the Mute function. LED :4,5,6,7,8,9
•Input Audio will play throw 4 speakers and all LEDs will be turned off. EX_INTERRUPT_HANDLER(FlagA_ISR){ if (low==0 && high==0)
{
*pFlashA_PortB_Data=0x00;
iChannel0LeftIn = iRxBuffer1[INTERNAL_ADC_L0];iChannel0RightIn = iRxBuffer1[INTERNAL_ADC_R0];iChannel1LeftIn = iRxBuffer1[INTERNAL_ADC_L1];//liChannel1RightIn = iRxBuffer1[INTERNAL_ADC_R1];
Original();
iTxBuffer1[INTERNAL_DAC_L0] = iChannel0LeftOut;iTxBuffer1[INTERNAL_DAC_R0] = iChannel0RightOut;iTxBuffer1[INTERNAL_DAC_L1] = iChannel1LeftOut;iTxBuffer1[INTERNAL_DAC_R1] = iChannel1RightOut;
}}
Design Example IIR lowpass /High pass filter design•Transfer function for IIR filter.
•we implement the Transfer function using the two formulas:
•Matlab•Low pass filter frequencies : Fstop= 5000 Hz
Fpass = 8000 Hz
•High pass filter frequencies : Fstop= 1400 Hz Fc = 2000 Hz
•Generate a Header file which include the filter coefficients.
2
21
1
22
110
1
zAzA
zBzBBzH
mdBmdBmdBmy
mdAmdAmxmd
012
12
12
12
Problems I have faced while implementing the IIR low pass filter:
•Filter coefficient collapsed and corrupt every now and then since yesterday night.
Solutions:
•Redesign the filter in math lab and redo the coefficient. But it is not a permanent solution because the problem keeps coming back
pressing PF8(once): Activates IIR low pass filter.
EX_INTERRUPT_HANDLER(FlagA_ISR){if(*pFIO_FLAG_C == 0x0100)
{ *pFIO_FLAG_C = 0x0100; high=0;
if(low<2) {
low++; }
else {
low=0; }
}
}
EX_INTERRUPT_HANDLER(Sport0_RX_ISR){if(low==1)
{ high=0;
*pFlashA_PortB_Data=0x01;
iChannel0LeftIn = iRxBuffer1[INTERNAL_ADC_L0]; iChannel0RightIn = iRxBuffer1[INTERNAL_ADC_R0]; iChannel1LeftIn = iRxBuffer1[INTERNAL_ADC_L1]; iChannel1RightIn = iRxBuffer1[INTERNAL_ADC_R1];
lowpassfilterIIR();
iTxBuffer1[INTERNAL_DAC_L0] = iChannel0LeftOut; iTxBuffer1[INTERNAL_DAC_R0] = iChannel0RightOut; iTxBuffer1[INTERNAL_DAC_L1] = iChannel1LeftOut; iTxBuffer1[INTERNAL_DAC_R1] = iChannel1RightOut;
}}
PF8(once) continue:
pressing PF8(twice): Activates FIR low pass filter.EX_INTERRUPT_HANDLER(Sport0_RX_ISR){
if(low==2)
{high=0;
*pFlashA_PortB_Data=0x03;
iChannel0LeftIn = iRxBuffer1[INTERNAL_ADC_L0];iChannel0RightIn = iRxBuffer1[INTERNAL_ADC_R0];iChannel1LeftIn = iRxBuffer1[INTERNAL_ADC_L1];iChannel1RightIn = iRxBuffer1[INTERNAL_ADC_R1];
highpassfilter_FIR();
iTxBuffer1[INTERNAL_DAC_L0] = iChannel0LeftOut;iTxBuffer1[INTERNAL_DAC_R0] = iChannel0RightOut;iTxBuffer1[INTERNAL_DAC_L1] = iChannel1LeftOut;iTxBuffer1[INTERNAL_DAC_R1] = iChannel1RightOut;}
}
pressing PF9(ONCE): Activates IIR High pass filter.
EX_INTERRUPT_HANDLER(FlagA_ISR){if(*pFIO_FLAG_C == 0x0200)
{ *pFIO_FLAG_C = 0x0200; low=0;
if(high<2) {
high++; }
else {
high=0; }
}
}
EX_INTERRUPT_HANDLER(Sport0_RX_ISR){if(high==1)
{ low=0;
*pFlashA_PortB_Data=0x0f;
iChannel0LeftIn = iRxBuffer1[INTERNAL_ADC_L0]; iChannel0RightIn = iRxBuffer1[INTERNAL_ADC_R0]; iChannel1LeftIn = iRxBuffer1[INTERNAL_ADC_L1]; iChannel1RightIn = iRxBuffer1[INTERNAL_ADC_R1];
HighpassfilterIIR();
iTxBuffer1[INTERNAL_DAC_L0] = iChannel0LeftOut; iTxBuffer1[INTERNAL_DAC_R0] = iChannel0RightOut; iTxBuffer1[INTERNAL_DAC_L1] = iChannel1LeftOut; iTxBuffer1[INTERNAL_DAC_R1] = iChannel1RightOut;
}}
PF9 (once)continue:
pressing PF9(twice): Activates FIR High pass filter.EX_INTERRUPT_HANDLER(Sport0_RX_ISR){
if(high==2)//plays audio input through the high pass filter
{low = 0;
*pFlashA_PortB_Data=0x3f;
iChannel0LeftIn = iRxBuffer1[INTERNAL_ADC_L0];iChannel0RightIn = iRxBuffer1[INTERNAL_ADC_R0];iChannel1LeftIn = iRxBuffer1[INTERNAL_ADC_L1];iChannel1RightIn = iRxBuffer1[INTERNAL_ADC_R1];
lowpassfilter_FIR();
iTxBuffer1[INTERNAL_DAC_L0] = iChannel0LeftOut;iTxBuffer1[INTERNAL_DAC_R0] = iChannel0RightOut;iTxBuffer1[INTERNAL_DAC_L1] = iChannel1LeftOut;iTxBuffer1[INTERNAL_DAC_R1] = iChannel1RightOut;
}
}
pressing PF10: Activates Mute function.EX_INTERRUPT_HANDLER(FlagA_ISR){
*pFIO_FLAG_C = 0x0400; if(mute<1) {
mute++;
}else {
mute=0; }
}}EX_INTERRUPT_HANDLER(Sport0_RX_ISR){
if(mute==1)
{ high=0; low=0; mute_b(); }
}
conclusion
• I got all other filters to work as expected in in this class .
• I re-design the IIR low pass many times since yesterday night and it continues to
corrupt . Hopefully it will work during the demonstration.
•things I would change:
• If I have taken Signal and Systems I would be able to
improve my filter and how they sound.
Recommended