I have a few questions about the built-in JUCE FFT, as I'm having trouble using it.
So as a very basic example, I initialise the FFT object with an order of 9 and inverse=false. I create an array that is twice the size of the fft size and fill the first half of it with the input buffer and the second half with zeros. Then, I perform an FFT on it using performRealOnlyForwardTransform(), which AFAIK, returns an interleaved array of real and imaginary components. I then take this array and perform an IFFT using performRealOnlyInverseTransform and store the first half of the result in the output buffer. So theoretically, whatever audio passes through it should remain unchanged. However, it seems like the result of the IFFT contains values outside the range of -1 to 1 and I get a very distorted result.
Do we need to normalise the output of the IFFT? Also, what does the inverse boolean do? Do I need to set it to true in order to be able to perform an IFFT? I get a jassert error when I do. :/
And then I use them like so. But I'm getting a jassert error. It seems like the inverse FFT enters the forward transform for some reason as the config object says inverse=true. fftInput is of length 1024 and I populate it with zeros before using it.
for (int channel = 0; channel < getTotalNumInputChannels(); ++channel){
for(unsigned int n=0; n<512; n++){
fftInput[n] = buffer.getReadPointer(channel)[n];
}
forFFT.performRealOnlyForwardTransform(fftInput);
invFFT.performRealOnlyInverseTransform(fftInput);
for(unsigned int n=0; n<512; n++){
buffer.getWritePointer(channel)[n] = fftInput[n];
}
}