I have a signal processing chain which goes:
-
- Every 256 samples, take 512 samples of input buffer
-
- Apply a Hann window to the samples
-
- Copy the windowed samples into the real components of a complex array
-
- FFT the complex array, obtaining complex spectral analysis data
-
- Modify the spectral analysis data
-
- IFFT the modified spectral analysis into a complex array
-
- Overlap-write the real components of the complex array into an output buffer at 256-sample intervals.
If stage 5 does nothing, the input signal is perfectly reconstructed. The data being overlap-written into the output buffer at (7) has the Hann window shape applied at (2), so the overlaps merge smoothly.
If in (5) I try to apply a spectral delay, by adding in frequency components captured in previous windows, the Hann window shape is lost - the output data no longer tapers to 0 at both ends - and the overlaps do not merge smoothly. Horrible crackles ensue.
I can reapply a Hann window to the output data before overlap-writing, but then I get a sort of "warbling" effect due to the fact that I've now effectively windowed the data twice.
Ideally the stage 5 processing would leave the window shape intact - but it's unclear how to do this when changing the spectral analysis data. (Note that I'm already ensuring that conjugate symmetry is preserved). Is there a missing step? Do I need to apply some phase adjustment to the delayed frequency components?