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:
Using
kiss_fft_next_fast_size(994)to determine that I should use 1000.Using
kiss_fft_alloc(...)to create a kiss_fft_cfg withnfft = 1000.Extending my input data from size 994 to 1000 by padding extra points as zero.
Passing kiss_fft_cfg to
kiss_fft(...)along with my input and output arrays.Using
kiss_fft_alloc(...)to create an inverse kiss_fft_cfg withnfft = 1000.Passing the inverse kiss_fft_cfg to
kiss_fft(...)inputting the previous output array.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?