DSPRelated.com
Forums

Re: Talkthrough for low freqency audio signal in BF533

Started by k_th...@yahoo.com May 18, 2006
Hello Benhard,every one else

I did filter implimentation like this given below,
1) I have done IIR filter Code in 'C'. This o/p signal OK.
2) The Original TalkThrough code in BF533 signal(HOST PC Audio I/P signal) with out filter signal OK.
3) HOST PC Audio I/P signal with filter Iam unable get audio signal.
where iam going to mistake in my code iam not understanding.
4) My all coefficient are OK. and i/p & o/p variable are iChannel1LeftIn and iChannel1LeftOut.
If any body have time please find out where iam going to mistake in my code.

I initialized this filter program in Process_data() calling function as follows.

void Process_Data(void)
{
//iChannel0LeftOut = iChannel0LeftIn;
//iChannel0RightOut = iChannel0RightIn;
//iChannel1LeftOut = iChannel1LeftIn;
//iChannel1RightOut = iChannel1RightIn;

int j,p;
double sum1,sum2,sum;
int tempa,tempb;
static int xbuff[5];
static int ybuff[5];

long int sumv;

if( count1 < 5 )
{
xbuff[count1] = (int)(iChannel1LeftIn * 4194304);// Normalizing input data
count1++;
ybuff[count1-1] = 0;
p = count1-1;
}
else
{
count1 = 0;
while(count1 < 4)
{
xbuff[count1] = xbuff[count1+1];
ybuff[count1] = ybuff[count1+1];
count1++;

}
xbuff[count1] = (int)(iChannel1LeftIn * 4194304);
ybuff[count1] = 0;
p = count1;
}
// IIR Filter with Fixed Point Representation

sum1=0;
sum2=0;
sum = 0;
for(j = 0;j <= 4;j++)
{
if( p-j == -1 )
break;
tempb = (int)(b[j] * 4096);//pow(2,12)@96)
sum1= sum1 + (double)((tempb) * (xbuff[p-j]));

if ( j + 1 == 5 || p-j-1 == -1 )
break;
tempa = (int) (a[j+1] * 4096);//pow(2,12)@96)
sum2 = sum2 + (double)(tempa) * (ybuff[p-j-1]);
}
sum = (sum1-sum2);
sumv = ((long)(sum / 1073741824));//pow(2,30)73741824
ybuff[p]= (int) (sumv * 4194304);//pow(2,22)A94304

iChannel1RightOut= ybuff[p] * 1073741824;
}
Can anybody suggest/correct me what i have to do to get filtered Output audio signal through the BF533 EZ lite Kit output Jacks.

A Great Thanks in Advance.
Thirumalesh.
>Hello Thirumalesh.
>
>Did you verify that your signal passes the line, if the filter is "open"?
>I'd suggest these steps:
>1) check with the original talkthrough code. Signal ok?
>2) check with your copy routines etc., but without filter. Signal ok?
>3) check with a plain filter: all coefficients set so that the original sig>nal
>is passed through without changes. (I guess a1=b1=1, others =0 should> do)
>Signal ok?
>4) Now set the filter's coefficents for a lowpass, but not too close to you>r
>signal, just to make sure, that lowpass filtering works (this is the
>easiest). You might use LP @ Fs/4. Signal ok?
>If not, check the signs of the coefficients (Analog Devices and Matlab used>
>different signs (at least some time ago)).
>
>If this filter fails, rethink your filter design.
>Your code isn't easily readable. There's good chance that a bug crept in.
>Often it helps to just recode it, increasing readability and transparency.
>
>If everything is ok up to now, I'd suppose that this thing happens:
>you're going to implement a highpass filter (or bandpass) which is far away>
>from your sampling rate (which might be 48kS/s or more).
>Depending on the method for your filter design, your coefficients can be so>
>close to zero or one, that the calculation process hasn't enough precision.
>Therefore the recursive process of your IIR filter fails, leaving you with >no
>signal or a wrong signal (typically, the signal is at one of the ends of th>e
>range or at zero).
>If this is the case, you can watch the behaviour, if you monitor the signal>
>during the first 10 (or 100) samples. It should start quite well, then afte>r
>some iterations, it reaches a limit of your range.
>
>A butterworth filter of 2nd order at 20Hz should be no problem, if everythi>ng
>is well done. However, there's not much room for loss of precision.
>
>Bernhard
>