when manipulating a live stream of audio data in the frequency domain, I've heard you need to do fft / ifft in small chunks, say 256 samples at a time.

I've also heard you need to somehow employ a window function but I'm not sure the details on that. Is that to prevent artifacts from popping up due to the circular nature of fft?

Is there anything else I should know that I haven't mentioned above if planning to do this? I also eventually want to figure out how to make windows work with convolution reverb, but assume the answer to that is big enough for its own question.

Thanks for any info!!

  • $\begingroup$ This might by intereseting: Algorithm for Pitch Shifter $\endgroup$
    – Vertex
    Apr 2, 2015 at 15:37
  • $\begingroup$ That is so awesome @Vertex. This is exactly what I needed, a working example of taking time domain samples, doing some work in frequency domain, and then returning back to time domain. Thanks so much! $\endgroup$
    – Alan Wolfe
    Apr 2, 2015 at 16:32

1 Answer 1


Analysis is separate from processing. Windowing helps remove certain artifacts during spectrum analysis, but since it is numerically lossy, isn't as useful when actually processing the audio for output. Instead, sufficient zero-padding (without any non-rectangular windowing) and the use of overlap-add or overlap-save is used for any fast convolution or frequency domain filtering. This prevents (actually just zeros) circular convolution artifacts.

Convolution reverb is already answered elsewhere, but in general can be done by breaking up the reverb impulse response into a whole series of overlap-save processing steps and summations (e.g. a 256k long reverb might be done using a series of 1,000 256+padding length FFT convolutions, or a mix of shorter and longer ones, with a future use buffer to hold most of those results till needed.)

  • $\begingroup$ Hi hotpaw2. I am using the overlap-add strategy for real-time guitar audio processing using my PC. Unfortunately, my FFT implementation introduces too much delay, introducing a discontinuity each time the FFT window moves. In my case, I am sampling at 48000Hz, with a window length of 1024 samples, and overlap of 512 samples. Thus, there is a noise with frequency 48000/512 = 93.75Hz. My SNR is close to 1.0. Do you have any tips? $\endgroup$ May 11, 2022 at 20:07
  • $\begingroup$ Right now I am using a passthrough filter for testing. impulse_respone(n)=delta(n). Even so, I still get significant noise. My guess is that if my FFT implementation is too slow, the incoming input samples for the next window will no longer be correlated with the last samples of the previous window. $\endgroup$ May 11, 2022 at 20:39
  • $\begingroup$ Very possibly a bug in your implementation. Try passing a long synthetic pure sinewave though your code, capture intermediate results, and debug till you get a long pure tone back out. $\endgroup$
    – hotpaw2
    May 11, 2022 at 21:12
  • $\begingroup$ That sounds like a good idea! I'll let you know how it works out! $\endgroup$ May 11, 2022 at 22:03
  • $\begingroup$ I followed your advice and debugged my FFT/IFFT code off-line with a long pure-tone. Turns out I simply had a bug in my code that does the actual audio streaming, and it is not related to FFT or IFFT processing time. Thank you so much! $\endgroup$ May 12, 2022 at 1:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.