I'm confused with overlap-add (OLA) in the following two scenarios

  • filtering/convolution an input signal;
  • applying an STFT on input signal only and draw its spectrogram.

When applying OLA to filtering/convolution, I'd take overlapped signal blocks, window them, take FFT of each windowed block, multiply filter core in frequency domain, IFFT the block, then apply OLA to the current block with buffered previous block in time domain.

When drawing spectrogram of the signal, I assume I must take overlapped signal blocks, window them, take FFT of each windowed block. Now I'm not sure how I would draw the spectrogram with the magnitude response with the block.

Which way of the following is correct?

  • Apply window function to each overlapped window, and then simply draw the FFT magnitude response of each window, making the windows next to each other as if the spectrum of each window corresponds to the center time or left edge of the window.
  • Apply window function to each overlapped window, add up the windowed time-domain signal between adjacent blocks. Then take FFT of the current block and draw it. This requires caching one signal buffer.

The first approach seems to give the wrong timeline, if we consider the block signal starts at its left edge and ends at its right edge, because it's overlapped with the next block, unless we say the resulting frequency response represents the non-overlapped portion of the window only.

The second approach seems to counteract the windowing and thus beats the purpose, because adding the overlapped portion in time domain will cancel out windowing on the overlap.

I'm confused which way would be the correct OLA for deriving the spectrogram of the running signal.


1 Answer 1


Apply window function to each overlapped window, and then simply draw the FFT magnitude response of each window as if the spectrum corresponds to the center time of the window.

Your approach is partially correct. But in the second half of sentence is not how you draw a spectrogram. You shouldn't align the FFT output in the same direction as time. It should be perpendicular direction as time. After you obtain FFT Magnitude, look at it from "above". Means the colour grades that you give depends on the magnitude value. This will be line corresponding to first window. Similarly, for second window, you place it next to it (since you took it after certain interval of time). An example below shows simple spectrogram having 3-bin FFT with middle bin having higher value compared to other bins.

enter image description here

  • $\begingroup$ Do you mean that even though the adjacent windows are overlapped, on the spectrogram, their magnitude responses are still next to each other? Those bins are thus spaced by the hop size in time, correct? We simply accept that the magnitudes derived from window-weighted blocks as they are, i.e., without spectral leakage. $\endgroup$
    – kakyo
    Mar 23, 2020 at 11:26
  • $\begingroup$ Yes you are correct. Even though they are overlapping in time, we cannot really overlap when you draw them. They can only be placed adjacent. One more thing - the spectral leakage you are referring to comes from leakage between bins of frequency, not between adjacent time. That is the real meaning of spectral leakage. $\endgroup$
    – jithin
    Mar 23, 2020 at 11:46
  • $\begingroup$ Thanks a lot, @jithin $\endgroup$
    – kakyo
    Mar 23, 2020 at 11:56
  • $\begingroup$ btw, I do know how to draw the magnitudes, but just wasn't sure how to align each vertical slice along the timeline. Maybe it wasn't clear in the second half of my sentence. $\endgroup$
    – kakyo
    Mar 23, 2020 at 12:00
  • $\begingroup$ You can overlap during spectrogram rendering by cross-fading the overlapped portions (when drawing at a higher resolution). $\endgroup$
    – hotpaw2
    Mar 23, 2020 at 15:00

Your Answer

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

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