Kiss FFT seems to multiply data by the number of points that it transforms

Viewed 1998

My limited understanding of the Fourier transform is that you should be able to toggle between the time and frequency domain without changing the original data. So, here is a summary of what I (think I) am doing:

  1. Using kiss_fft_next_fast_size(994) to determine that I should use 1000.

  2. Using kiss_fft_alloc(...) to create a kiss_fft_cfg with nfft = 1000.

  3. Extending my input data from size 994 to 1000 by padding extra points as zero.

  4. Passing kiss_fft_cfg to kiss_fft(...) along with my input and output arrays.

  5. Using kiss_fft_alloc(...) to create an inverse kiss_fft_cfg with nfft = 1000.

  6. Passing the inverse kiss_fft_cfg to kiss_fft(...) inputting the previous output array.

  7. Expecting the original data back, but getting each datum exactly 1000 times bigger!

I have put a full example here, and my 50-odd lines of code can be found right at the end. Although I can work around this by dividing each result by the value of OPTIMAL_SIZE (i.e. 1000) that fix makes me very uneasy without understanding why.

Please can you advise what simply stupid thing(s) I am doing wrong?

1 Answers
Related