Hi,
I am using DSK5416 along with CCS3.1. I am trying to implement noise cancellation, for that I am using a wav file in which right channel corresponds to the desired sound and left channel is the noise. I am unable to separate the left and right channel signals. Even if I try to simply read the left and right channel , and try to output on the left , at the output I will get both left and right channel combined.For your reference source code is given below.Is there any proper document that gives the complete procedure for reading and writing of audio signal (including the configuration). Please give the link for it.
#include "YYYYcfg.h"
#include <dsk5416.h>
#include <dsk5416_pcm3002.h>
Int16 left_input; Int16 left_output; Int16 right_input; Int16 right_output;
float w[] ={-0.000019,-0.000170,-0.000609,-0.001451,-0.002593,-0.003511,-0.003150,0.000000,0.007551,0.020655,0.039383,0.062306,0.086494,0.108031,0.122944,0.128279,0.122944,0.108031,0.086494,0.062306,0.039383,0.020655,0.007551,0.000000,-0.003150,-0.003511,-0.002593,-0.001451,-0.000609,-0.000170,-0.000019};
static short delay[100];
DSK5416_PCM3002_Config setup = {
0x1ff, // Set-Up Reg 0 - Left channel DAC attenuation
0x1ff, // Set-Up Reg 1 - Right channel DAC attenuation
0x0, // Set-Up Reg 2 - Various ctl e.g. power-down modes
0x0 // Set-Up Reg 3 - Codec data format control
};
void main ()
{ DSK5416_PCM3002_CodecHandle hCodec; // Initialize the board support library
DSK5416_init(); // Start the codec
hCodec = DSK5416_PCM3002_openCodec(0, &setup); // Set codec frequency
DSK5416_PCM3002_setFreq(hCodec,8000); // Endless loop IO audio codec
while(1)
{ // Read 16 bits of codec data, loop to retry if data port is busy
while(!DSK5416_PCM3002_read16(hCodec, &left_input));
while(!DSK5416_PCM3002_read16(hCodec, &right_input));
left_output=adaptive_filter(left_input,right_input);
right_output=left_output;
// Write 16 bits to the codec, loop to retry if data port is busy
while(!DSK5416_PCM3002_write16(hCodec, left_input));
while(!DSK5416_PCM3002_write16(hCodec, right_input));
}}
signed int adaptive_filter(signed int l_input1,signed int r_input1)
{ short i,output,T;
float yn=0,E=0,dplusn=0,noise=0,desired=0;
for(T=0;T<30;T++) { w[T]=0; delay[T]=0; }
desired=l_input1; noise=r_input1;
dplusn=desired+noise; delay[0]=noise;
for(i=0;i<30;i++)
{
yn+=(w[i]*delay[i]);
E=(desired+noise)-yn;
for(i=29;i>=0;i--)
{
w[i]=w[i]+.01 * E* delay[i];
delay[i]=delay[i-1];
} }
output=((short)E);
return(output);
}
Kindly help to solve this problem...
Thanks in advance...