Overlapping in real time fourier transform?

I have an algorithm and I need to record audio and perform short time Fourier transform to obtain which frequency is the most common. I am using a Hanning window to try and reduce spectral leakage as much as possible. My problem is how should I overlap the data because since it is in real time I will no have the next part of the data. Should I perform the Fourier transform in delay so that I can overlap the next segment.
So basically I am computing the the Fourier Transform of the red part, I do not have the blue part yet because it is still in the future. How can this problem be solved? Should I wait for the next segment to be recorded and perform the Fourier Transform of the past data so effectively having a delay?

• Yes, just do some buffering. You are doing it anyway, since you have to wait until a window is complete to calculate its transform. So your minimum delay is always one window length.
– Max
Apr 25 '19 at 8:56

Overlapping FFTs, and averaging them, provide an excellent way to more accurately render the noise floor of the signal being observed. That said, you cannot actually start the FFT until you have enough samples, in part because the "last" sample will be used even on the very first butterfly computation.

That said, the time to compute the FFT can be quite short, and shortened further by putting part of it in an FPGA, depending on the signal that can achieve a very short time between the computation and the ability to act on that computation. The latency of that action would then be the number of bins in your FFT multiplied by the sample rate (time to get one FFT) plus the time to execute your recognition code and response. You can compare that time to the rate at which new signals appear or disappear in the sampled signal to see how close you are to "real time."

For audio data recording at 192K samples per second, each sample takes about 5 microseconds to come in, and even a small FPGA can compute a 1024 bin FFT in under a microsecond, so well before the sample after the last one has arrived.

I can see two concepts here in favor of delays.

First frequency. A koan asks the sound of only one hand clapping? In signal processing, one may ask about the frequency of only one sample, or is there something like instantaneous frequency on one sample? It seems that frequency somehow requires more than one sample, and some symmetry around it sounds reasonable. Thus, it is difficult to have symmetry around the last sample in a real-time setting.

Second, most common (to obtain which frequency is the most common). The most common statistics corresponds to the mode, and requires to quantize and gather "all" frequencies before being able to find the most common. The way you quantize frequencies could be a crucial factor here.

If you still want to find the most common, not on the whole signal, but on sliding windows, delays can be reduced.