c - KissFFT output of kiss_fftr -
i'm receiving pcm data trough socket connection in packets containing 320 samples. sample rate of sound 8000 samples per second. doing this:
int size = 160 * 2;//160; int isinverse = 1; kiss_fft_scalar zero; memset(&zero,0,sizeof(zero)); kiss_fft_cpx fft_in[size]; kiss_fft_cpx fft_out[size]; kiss_fft_cpx fft_reconstructed[size]; kiss_fftr_cfg fft = kiss_fftr_alloc(size*2 ,0 ,0,0); kiss_fftr_cfg ifft = kiss_fftr_alloc(size*2,isinverse,0,0); (int = 0; < size; i++) { fft_in[i].r = zero; fft_in[i].i = zero; fft_out[i].r = zero; fft_out[i].i = zero; fft_reconstructed[i].r = zero; fft_reconstructed[i].i = zero; } // got data through socket connection (int = 0; < size; i++) { // samples type of short fft_in[i].r = samples[i]; fft_in[i].i = zero; fft_out[i].r = zero; fft_out[i].i = zero; } kiss_fftr(fft, (kiss_fft_scalar*) fft_in, fft_out); kiss_fftri(ifft, fft_out, (kiss_fft_scalar*)fft_reconstructed); // lets normalize samples (int = 0; < size; i++) { short* samples = (short*) buftmp1; samples[i] = rint(fft_reconstructed[i].r/(size*2)); } after fill openal buffers , play them. works fine filtering of audio between kiss_fftr , kiss_fftri. starting point think convert sound time domain frequency domain, don't understand kind of data i'm receiving kiss_fftr function. information stored in each of complex number, real , imaginary part can tell me frequency. , don't know frequencies covered (what frequency span) in fft_out - indexes corresponds frequencies.
i total newbie in signal processing , fourier transform topics.
any help?
before jump in both feet c implementation, familiar digital filters, esp fir filters.
you can design fir filter using gnu octave's signal toolbox. @ command fir1(the simplest), firls, or remez. alternately, might able design fir filter through web page. quick web search "online fir filter design" found this (i have not used it, appears use equiripple design used in remez or firpm command )
try implementing filter first direct convolution (without ffts) , see if speed acceptable -- easier path. if need fft-based approach, there sample implementation of overlap-save in kissfft/tools/kiss_fastfir.c file.
Comments
Post a Comment