I need to sample through codec, compute 64 point FFT and detect car horn frequency from the FFT results for my application. I am using the audio_filter demo for USB stick. I have modified the FFT_Filter() function as I do not need convolution/IFFT, but only FFT. The function is like this now.
void FFT_Filter(Int32 *In, Int32 *Out)
{
Int32 *data_br;
Uint16 fft_flag, scale_flag;
data_br = data_br_buf;
// FFT Input Samples:
fft_flag = FFT_FLAG;
scale_flag = SCALE_FLAG;
hwafft_br(In, data_br, FFT_LENGTH); // bit-reverse input data
(*Hwafft_Func) (&data_br[0], Out, fft_flag, scale_flag); //
perform FFT
}
In main() I call
FFT_Filter(&FilterIn[0], &FilterOut[0]);
Now if I want to print the FFT result or compare the FFT result with say MATLAB FFT result for the same .wav file. What should I do?
What I understand is MSB 16 bits of FilterOut[] contains the real part of the result. So I need to do FilterOut[0] >> 16.
Now for S16Q15, I read it is 16 bits with 15 bits denoting fractional part after decimal point. So will (FilterOut[0]
>> 16) && 0x8000 give me the sign of the result?
And how should I print the fractional part for correct interpretation? (Int16)((FilterOut[0] >> 16) && 0x7FFF) will give me some value between 0 and 32767. How will I map that to FFT result which is said to range between -1 and 0.9999 (in the release ) note that came with the audio filter demo?
Will MATLAB reult also be between -1 and .9999? Or I have to normalize or do something else?
Please help me to correctly interpret the ezdsp FFT results.
Thanks in advance,
Riju