📄 notch2.c
字号:
//NOTCH2.C Two FIR notch filters to remove two sinusoidal noise signals
#include "BS900.cof" //BS @ 900 Hz coefficient file
#include "BS2700.cof" //BS @ 2700 Hz coefficient file
short dly1[N]={0}; //delay samples for 1st filter
short dly2[N]={0}; //delay samples for 2nd filter
int y1out = 0, y2out = 0; //init output of each filter
short out_type = 1; //slider for output type
interrupt void c_int11() //ISR
{
short i;
dly1[0] = input_sample(); //newest input @ top of buffer
y1out = 0; //init output of 1st filter
y2out = 0; //init output of 2nd filter
for (i = 0; i< N; i++)
y1out += h900[i]*dly1[i]; //y1(n)+=h900(i)*x(n-i)
dly2[0]=(y1out >>15); //out of 1st filter->in 2nd filter
for (i = 0; i< N; i++)
y2out += h2700[i]*dly2[i]; //y2(n)+=h2700(i)*x(n-i)
for (i = N-1; i > 0; i--) //from bottom of buffer
{
dly1[i] = dly1[i-1]; //update samples of 1st buffer
dly2[i] = dly2[i-1]; //update samples of 2nd buffer
}
if (out_type==1) //if slider is in position 1
output_sample(dly1[0]); //corrupted input(voice+sines)
if (out_type==2)
output_sample(y2out>>15); //output of 2nd filter (voice)
return; //return from ISR
}
void main()
{
comm_intr(); //init DSK, codec, McBSP
while(1); //infinite loop
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -