Technical discussions about the TI C6000 DSPs (including the c62x, c64x and c67x DSPs).
|
I am doing a thesis on Active noise control using the C6701. The first step of the project is to take TI's audio.c example code, implement an FIR filter and then listen to the result. I have added code to the 'processing' function and it compiles. However when I run it and input a stream of audio samples the output is dominated by noise...I have included the offending source code below. I am not very familiar with this chip so I would appreciate hugely any help especially if if you have attempted this problem before or if you know of any working FIR code for the C6701... cheers! static Void process(Uns *src, Int size, Uns *dst) { int i; for (i = size - 1; i >= 0; i--){ x[0] = (float)src[i]; //update most recent sample sum = 0.0; for (i=0; i<11; i++){ sum += (coef[i]*x[i]); //multiply sample by filter coef.s } //coef[] and x[](storage array) are declared globally dst[i]=(uns)sum; //let sample at destination = filtered sample for (i=11; i>0; i--) //shift sample x[i] = x[i-1]; } /* if hostPipe is non-NULL write data to this pipe */ if (hostPipe != NULL) { writeBuf(hostPipe, dst, size); } } |
|
|
|
Hello, I think that you have a C-programming problem instead of a C6701 problem. You must use different variables for your loops, unless it is happening whatever you did not expected : - first loop starts : (i=size-1), - second loop starts : (i=0 !!!), so the first loop will never work correctly... I think that it is the reason why all you hear is noise. Hope this helps. Regards, Franck -----Original Message----- From: seamusshovel [mailto:] Sent: mercredi 6 mars 2002 17:50 To: Subject: [c6x] FIR filter based on audio.c code I am doing a thesis on Active noise control using the C6701. The first step of the project is to take TI's audio.c example code, implement an FIR filter and then listen to the result. I have added code to the 'processing' function and it compiles. However when I run it and input a stream of audio samples the output is dominated by noise...I have included the offending source code below. I am not very familiar with this chip so I would appreciate hugely any help especially if if you have attempted this problem before or if you know of any working FIR code for the C6701... cheers! static Void process(Uns *src, Int size, Uns *dst) { int i; for (i = size - 1; i >= 0; i--){ x[0] = (float)src[i]; //update most recent sample sum = 0.0; for (i=0; i<11; i++){ sum += (coef[i]*x[i]); //multiply sample by filter coef.s } //coef[] and x[](storage array) are declared globally dst[i]=(uns)sum; //let sample at destination = filtered sample for (i=11; i>0; i--) //shift sample x[i] = x[i-1]; } /* if hostPipe is non-NULL write data to this pipe */ if (hostPipe != NULL) { writeBuf(hostPipe, dst, size); } } _____________________________________ |