Hi Guys,
I have been trying to compute FFT of real time signal using dsk_app.c project given in C6713 example codes. As you know, in dsk_app.c project, input is taken from LINE IN jack and output is throughing using LINE OUT jack with out any change. I am trying to compute FFT before outputtiing the samples. I inputed a simple sine wave of 1 Khz with 1 Vp_p but I am not getting the peak at 1 Khz.. I'm basically converting both the ping and pong buffers into real and imaginary parts and then using fft on those buffers.
I processed the sampled data in void processBuffer(void) function in the following way.
float x1[BUFFSIZE]; // BUFFSIZE = 1024;
float y1[BUFFSIZE];
void processBuffer(void)
{
Uint32 pingPong;
Int16 i;
/* Get contents of mailbox posted by edmaHwi */
pingPong = SWI_getmbox();
/* Copy data from transmit to receive, could process audio here */
if (pingPong == PING) {
for (i = 0 ; i < BUFFSIZE ; i++) // Converting values into real and imm part for FFT
{
samples[i].real= (float)gBufferRcvPing[i]; // changing RcvPing from int16 type to float type for FFT calculation
}
for (i = 0 ; i < BUFFSIZE ; i++)
samples[i].imag = 0.0; //imag components = 0
FFT(samples,BUFFSIZE); //call function FFT.c
for (i = 0 ; i < BUFFSIZE ; i++) //compute magnitude
{
x1[i] = sqrt(samples[i].real*samples[i].real + samples[i].imag*samples[i].imag);
gBufferXmtPing[i] = (Int16)x1[i]; // chaning back from float type to int16 type before transmitting
}
/* Copy receive PING buffer to transmit PING buffer */
copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);
} else {
for (i = 0 ; i < BUFFSIZE ; i++) // Converting values into real and imm part for FFT
{
samples[i].real= (float)gBufferRcvPong[i]; // chaning back from float type to int16 type before transmitting
}
for (i = 0 ; i < BUFFSIZE ; i++)
samples[i].imag = 0.0; //imag components = 0
FFT(samples,BUFFSIZE); //call function FFT.c
for (i = 0 ; i < BUFFSIZE ; i++) //compute magnitude
{
y1[i] = sqrt(samples[i].real*samples[i].real + samples[i].imag*samples[i].imag);
gBufferXmtPong[i] = (Int16)y1[i]; // chaning back from float type to int16 type before transmitting
}
/* Copy receive PONG buffer to transmit PONG buffer */
copyData(gBufferRcvPong, gBufferXmtPong, BUFFSIZE);
}
}
Can any one please explain me where I am missing some thing or what is wrong ?
Looking forward for your kind help.
Thanks and Regards.