FFT question


#1

Hi everyone
I was experimenting with the FFT class and i noticed the result is a bit different from what i get from the FFT module in the flowstone.

dsp::FFT myFFT(2);
dsp::Complex inputfft[4];
dsp::Complex outputfft[4];

inputfft[0].real(1.0f); inputfft[1].real(0.0f);
inputfft[2].real(0.0f); inputfft[3].real(-1.0f);
inputfft[0].imag(0.0f); inputfft[1].imag(0.0f);
inputfft[2].imag(0.0f); inputfft[3].imag(0.0f);

myFFT.perform(inputfft, outputfft, false);
// myFFT.perform(inputfft, outputfft, true); (inverse)

input data: Real: {1, 0, 0, -1} Imag: {0, 0, 0, 0}.
results:
JUCE FFT : Real: {0, 1, 2, 1} Imag: {0, -1, 0, 1}.
JUCE inverse FFT: Real: {0, 0.25, 0.5, 0.25} Imag: {0, 0.25, 0, -0.25}.
Flowstone FFT: Real: {0, 0.25, 0.5, 0.25} Imag: {0, -0.25, 0, 0.25}
Flowstone inverse FFT: Real: {0, 1, 2, 1} Imag: {0, 1, 0, -1}

Whats going on? Am i doing something wrong or what?


#2

This is not a problem.
Look at the FFT equations. There is a scaling factor that can be applied either during direct or inverse FFT. JUCE decides to use it after, and it is perfectly fine (it’s actually a flag on IPP as well), FlowStone does it before.