Again I have another problem. The algorithm takes a fftw_complex, and output a similar object. What I have is signed 16bit int array. How do I pass this array to the algorithm? And how to read from the receiving data? Thanks.
Again I have another problem. The algorithm takes a fftw_complex, and output a similar object. What I have is signed 16bit int array. How do I pass this array to the algorithm?
You don't need fftw_complex for input data when converting. But you do need floating points.
You need to convert your signed 16 bit array to an array of real numbers (either floats or doubles) which scales the output to [-1, 1]. With 16-bit data, the output is scaled to [-32768, 32767], so the conversion is pretty simple:
You can the pass that double buffer to fftw_plan_dft_r2c_1d to do the FFT conversion. It will fill an output buffer that is fftw_complex. (r2c = real to complex)
Do your modifications to the fftw_complex buffer, then pass it back to fftw_plan_dft_c2r_1d (c2r = complex to real) to get back pcm samples in the form of floating point... then covert those floating points back to shorts by scaling them up.
Actually you might not have to do any scaling.... The FFT will probably work just as well if you keep the numbers scaled at [-32768, 32767], you'll just be working with much larger numbers in your calculations. You'll still need to convert to doubles/floats though ... no way around that.