# Short-time Fourier transform

The short-time [Fourier transform](https://www.edgepedia.org/fourier-transform) (STFT) is a signal-processing transform that computes the Fourier transform of successive short, windowed segments of a signal, producing a two-dimensional representation of how the signal's frequency content changes over time. It is also called the windowed Fourier transform or, in its Gaussian-window form, the [Gabor transform](https://www.edgepedia.org/gabor-transform).<sup>[1](https://www.its.ntia.gov/umbraco/surface/download/publication?reportNumber=93-302.pdf)</sup><sup> • </sup><sup>[2](https://nd.psychstat.org/_media/lab/handbook_of_computational_statistics.pdf)</sup>

| Key fact | Detail |
|---|---|
| Definition | For a continuous signal \( x(t) \), \( S(f,t) = \int x(\xi)\, \overline{w(\xi-t)}\, e^{-j2\pi f \xi}\, d\xi \), the inner product of the signal with a window translated in time and modulated in frequency<sup>[3](https://docs.scipy.org/doc/scipy/tutorial/signal.html)</sup> |
| Origin | Introduced by Dennis Gabor in 1946 to measure time-localized frequencies of sound<sup>[2](https://nd.psychstat.org/_media/lab/handbook_of_computational_statistics.pdf)</sup> |
| Resolution trade-off | Time-frequency resolution is fixed over the plane and bounded below by \( \Delta\omega\,\Delta t \ge 1/(4\pi) \); the Gaussian window attains equality<sup>[1](https://www.its.ntia.gov/umbraco/surface/download/publication?reportNumber=93-302.pdf)</sup><sup> • </sup><sup>[21](https://pmc.ncbi.nlm.nih.gov/articles/PMC4804002/)</sup> |
| Key parameters | Frame length \( N_F \) sets frequency resolution \( \Delta f = f_s / N_F \); hop length \( N_H \) sets time resolution and cost but does not affect frequency resolution<sup>[4](https://www.cs.cmu.edu/~15322/book/ch10/04.html)</sup> |
| Inverse | The inverse STFT takes the IFFT of each frame and overlap-adds the results; perfect reconstruction requires the nonzero overlap-add (NOLA) condition<sup>[5](https://www.mathworks.com/help/signal/ref/istft.html)</sup><sup> • </sup><sup>[22](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.istft.html)</sup> |
| Common defaults | librosa.stft uses \( n_{\text{fft}} = 2048 \) samples and a hop of 512, i.e. 93 ms frames and 23 ms hops at 22050 Hz, yielding 1025 frequency bins<sup>[6](https://librosa.org/doc/main/auto_tutorials/01-intro/02-frequency.html)</sup> |
| Typical uses | Spectrograms, the phase vocoder, filtering and filter banks, and input features for machine-learning audio models<sup>[7](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ShortTimeFFT.html)</sup><sup> • </sup><sup>[8](https://arxiv.org/abs/1902.00631)</sup> |

## Definition and interpretation

The STFT addresses a limitation of the ordinary Fourier transform, which integrates over all time and therefore discards when each frequency occurred. For music, speech, and other non-stationary signals, frequency content changes over time, so a single global spectrum is not enough.<sup>[4](https://www.cs.cmu.edu/~15322/book/ch10/04.html)</sup>

The transform localizes the signal in time by multiplying it with a window function \( w(t) \), a function of compact support or rapid decay such as a Hann or Gaussian window, and then taking the Fourier transform of the product. Sliding the window along the signal and repeating produces a function of both time and frequency:<sup>[1](https://www.its.ntia.gov/umbraco/surface/download/publication?reportNumber=93-302.pdf)</sup><sup> • </sup><sup>[3](https://docs.scipy.org/doc/scipy/tutorial/signal.html)</sup>

\[ S(f,t) := \int_{-\infty}^{\infty} x(\xi)\, \overline{w(\xi-t)}\, e^{-j2\pi f \xi}\, d\xi \]

This can be read two ways. As a windowed spectrum, it is the Fourier transform of the segment \( x(\tau) w(\tau - t) \) centered at time \( t \). As a filter bank, it filters the signal with a bandpass filter whose impulse response is the window modulated to frequency \( f \); the two views are equivalent when the window and its Fourier transform are a transform pair.<sup>[1](https://www.its.ntia.gov/umbraco/surface/download/publication?reportNumber=93-302.pdf)</sup><sup> • </sup><sup>[9](https://www.gretsi.fr/historique/temps-frequence)</sup>

For sampled signals \( x[k] = x(kT) \) with sampling interval \( T \), the discrete STFT evaluates \( S \) on a grid \( S[q,p] = S(q\,\Delta f,\, p\,\Delta t) \). In a typical implementation the \( p \)-th column holds an FFT of the window centered at time \( t[p] = p \cdot \text{hop} \cdot T \), and the \( q \)-th row holds the values at frequency \( f[q] = q \cdot \Delta f \) with bin width \( \Delta f = 1/(N_{\text{fft}} \cdot T) \).<sup>[3](https://docs.scipy.org/doc/scipy/tutorial/signal.html)</sup><sup> • </sup><sup>[7](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ShortTimeFFT.html)</sup>

## Time-frequency resolution and the uncertainty principle

Because the same window is used at every frequency, the STFT's resolution is fixed across the time-frequency plane. A narrow window gives good time resolution but blurs frequency; a wide window resolves nearby tones but smears events in time. The product of the two resolutions is bounded below by the uncertainty relation<sup>[1](https://www.its.ntia.gov/umbraco/surface/download/publication?reportNumber=93-302.pdf)</sup>

\[ \Delta\omega\,\Delta t \ge \frac{1}{2} \]<sup>[21](https://pmc.ncbi.nlm.nih.gov/articles/PMC4804002/)</sup>

with equality for a Gaussian window, which is therefore the optimal window for time-frequency resolution. Two frequencies cannot be resolved unless they are more than \( \Delta\omega \) apart, and two pulses cannot be resolved unless they are more than \( \Delta t \) apart. This fixed tiling means the STFT is not well suited to signals that need fine resolution at high and low frequencies simultaneously.<sup>[1](https://www.its.ntia.gov/umbraco/surface/download/publication?reportNumber=93-302.pdf)</sup>

**Choosing the parameters.** In discrete implementations the two knobs are the frame length \( N_F \) and the hop length \( N_H \). Longer frames pack DFT bins closer together, \( \Delta f = f_s / N_F \), improving frequency resolution at the cost of time resolution; in the limit where the frame spans the whole signal, the STFT reduces to a single global DFT. The hop length does not change frequency resolution at all; it controls how many frames per second are produced and hence the computational cost, since \( N \) samples yield \( N/N_H \) frames. Common practice uses a power-of-two frame length for FFT efficiency and a frame long enough to cover at least one cycle of the lowest frequency of interest; at 44.1 kHz, a 4096-sample frame (about 93 ms) covers the 20 Hz lower limit of human hearing.<sup>[4](https://www.cs.cmu.edu/~15322/book/ch10/04.html)</sup>

## The inverse transform and perfect reconstruction

The inverse STFT reverses the analysis: take the inverse FFT of each time slice, multiply by a synthesis (dual) window, shift the result to its original time position, and overlap-add the shifted pieces. Reconstruction is exact when the analysis window satisfies the constant overlap-add (COLA) constraint at the chosen hop size \( R \),<sup>[5](https://www.mathworks.com/help/signal/ref/istft.html)</sup><sup> • </sup><sup>[10](https://www.mathworks.com/help/dsp/ref/dsp.stft.html)</sup>

\[ \sum_{m=-\infty}^{\infty} g^{a+1}(n - mR) = c, \quad \forall n \in \mathbb{Z} \]

where \( c \) is a nonzero constant and \( a = 0 \) for plain overlap-add (OLA) or \( a = 1 \) for weighted overlap-add (WOLA). Weak COLA compliance relies on alias cancellation in the frequency domain and gives perfect reconstruction only for unmodified spectra; strong COLA compliance additionally requires the window's Fourier transform to be bandlimited to \( f < 1/(2R) \), so no aliasing occurs, and is preferred when the short-time spectrum is modified, as in audio effects. A useful WOLA window can be built as the square root of a strong OLA window, the root-Hann window being a standard example.<sup>[5](https://www.mathworks.com/help/signal/ref/istft.html)</sup>

## Applications

**Spectrograms.** The most familiar application is the spectrogram, a time-frequency plot in which color or intensity shows power. The term is used both for such plots generally and, more specifically, for the absolute square of the STFT.<sup>[7](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ShortTimeFFT.html)</sup> Spectrogram-based features dominate the input representations of deep-learning audio systems, because they present sound as a two-dimensional image to which convolutional networks apply directly.<sup>[11](https://arxiv.org/abs/2603.14917)</sup>

**Phase vocoder and audio effects.** The phase vocoder, first implemented as a filter bank, uses the STFT's short-term amplitude and phase spectra to transform sounds: time stretching, pitch shifting, denoising, and component separation all operate by modifying the two-dimensional representation and resynthesizing.<sup>[12](https://www.dafx.de/DAFX_Book_Page/chapter8.html)</sup><sup> • </sup><sup>[13](https://www.ee.columbia.edu/~dpwe/classes/e4810-2002-09/projects/arroyo/analysis.html)</sup> The phase vocoder exploits phase information that a plain magnitude spectrogram ignores to make improved frequency estimates.<sup>[14](https://sethares.engr.wisc.edu/htmlRT/vocoders/phasevocoder.html)</sup>

**Speech and machine learning.** The STFT is the standard front end of monaural speech separation methods such as deep clustering and permutation invariant training.<sup>[8](https://arxiv.org/abs/1902.00631)</sup> In comparative studies of input representations for environmental sound classification with convolutional neural networks, Mel-scaled STFT slightly outperformed the constant-Q transform, the continuous wavelet transform, and baseline MFCC features, with the optimal window size depending on the signal.<sup>[15](https://arxiv.org/abs/1706.07156)</sup>

## Alternatives and variants

The fixed window is the STFT's main structural limitation, and several families of transforms address it. The constant-Q transform spaces its frequency bins geometrically with a constant [Q factor](https://www.edgepedia.org/q-factor), matching musical pitch and the frequency resolving power of the human auditory system; it was initially proposed for music analysis.<sup>[16](https://www.iit.comillas.edu/documentacion/revista/IIT-20-048A_preprint/Bridging_the_gap_between_the_short-time_fourier_transform_%28STFT%29%2C_wavelets%2C_the_constant-Q_transform_and_multi-resolution_STFT.pdf)</sup><sup> • </sup><sup>[8](https://arxiv.org/abs/1902.00631)</sup> The wavelet transform partitions the time-frequency plane with a constant relative bandwidth instead of a constant bandwidth, giving scale-adaptive resolution that aligns better with some signal structures.<sup>[17](https://www.mdpi.com/2079-9292/15/10/2004)</sup><sup> • </sup><sup>[18](https://www.sciencedirect.com/science/article/pii/S0169743997000294)</sup> Within the STFT family itself, adaptive STFT adjusts the window size to local signal characteristics, and multi-resolution STFT processes different frequency bands with different window sizes; multi-scale STFT combines both, adjusting the window in time and frequency to match the transience of individual components.<sup>[16](https://www.iit.comillas.edu/documentacion/revista/IIT-20-048A_preprint/Bridging_the_gap_between_the_short-time_fourier_transform_%28STFT%29%2C_wavelets%2C_the_constant-Q_transform_and_multi-resolution_STFT.pdf)</sup>

**Software implementations.** In SciPy, the newer `ShortTimeFFT` class provides a parametrized discrete STFT and its inverse, with the canonical dual window of minimal energy used by default; the older `stft` function is legacy and no longer receives updates.<sup>[7](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ShortTimeFFT.html)</sup><sup> • </sup><sup>[19](https://cache-docs.scipy.org/doc/scipy/reference/generated/scipy.signal.stft.html)</sup> In librosa, `stft` defaults to a 2048-sample frame and 512-sample hop, 93 ms and 23 ms at the default 22050 Hz sample rate, with 512 recommended for speech; smaller hop lengths increase the number of time columns without affecting frequency resolution.<sup>[6](https://librosa.org/doc/main/auto_tutorials/01-intro/02-frequency.html)</sup><sup> • </sup><sup>[20](https://librosa.org/doc/0.10.2/generated/librosa.stft.html)</sup>

## References

1. [Windowed Fourier transform chapter, NTIA report 93-302](https://www.its.ntia.gov/umbraco/surface/download/publication?reportNumber=93-302.pdf)
2. [Handbook of Computational Statistics, chapter on time-frequency analysis (Gabor 1946)](https://nd.psychstat.org/_media/lab/handbook_of_computational_statistics.pdf)
3. [Signal Processing (scipy.signal), SciPy v1.18.0 User Guide](https://docs.scipy.org/doc/scipy/tutorial/signal.html)
4. [10.4 The short-time Fourier transform, CMU Intro to Computer Music](https://www.cs.cmu.edu/~15322/book/ch10/04.html)
5. [istft, Inverse short-time Fourier transform, MATLAB Signal Processing Toolbox](https://www.mathworks.com/help/signal/ref/istft.html)
6. [Frequency and time-frequency analysis, librosa 1.0.0 documentation](https://librosa.org/doc/main/auto_tutorials/01-intro/02-frequency.html)
7. [ShortTimeFFT, SciPy v1.18.0 Reference](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ShortTimeFFT.html)
8. [Is CQT more suitable for monaural speech separation than STFT? An empirical study, arXiv:1902.00631](https://arxiv.org/abs/1902.00631)
9. [Histoire du TSI, Analyse Temps-Fréquence, GRETSI](https://www.gretsi.fr/historique/temps-frequence)
10. [dsp.STFT, Short-time FFT, MATLAB DSP System Toolbox](https://www.mathworks.com/help/dsp/ref/dsp.stft.html)
11. [Spectrogram features for audio and speech analysis, arXiv:2603.14917](https://arxiv.org/abs/2603.14917)
12. [DAFX Digital Audio Effects, Chapter 8: Time-frequency Processing](https://www.dafx.de/DAFX_Book_Page/chapter8.html)
13. [DSP analysis notes, Columbia University E4810](https://www.ee.columbia.edu/~dpwe/classes/e4810-2002-09/projects/arroyo/analysis.html)
14. [The phase vocoder in Matlab, Sethares et al.](https://sethares.engr.wisc.edu/htmlRT/vocoders/phasevocoder.html)
15. [Comparison of Time-Frequency Representations for Environmental Sound Classification using CNNs, arXiv:1706.07156](https://arxiv.org/abs/1706.07156)
16. [Bridging the gap between the STFT, Wavelets, the Constant-Q Transform and Multi-resolution STFT, Mateo & Talavera](https://www.iit.comillas.edu/documentacion/revista/IIT-20-048A_preprint/Bridging_the_gap_between_the_short-time_fourier_transform_%28STFT%29%2C_wavelets%2C_the_constant-Q_transform_and_multi-resolution_STFT.pdf)
17. [A Unified Structural Framework for Time-Frequency Analysis and Machine Learning in Condition Monitoring, Electronics 15(10):2004](https://www.mdpi.com/2079-9292/15/10/2004)
18. [An introduction to wavelet transforms for chemometricians, Chemometrics and Intelligent Laboratory Systems](https://www.sciencedirect.com/science/article/pii/S0169743997000294)
19. [stft (legacy), SciPy v1.18.0 Reference](https://cache-docs.scipy.org/doc/scipy/reference/generated/scipy.signal.stft.html)
20. [librosa.stft, librosa 0.10.2 documentation](https://librosa.org/doc/0.10.2/generated/librosa.stft.html)
21. [pmc.ncbi.nlm.nih.gov](https://pmc.ncbi.nlm.nih.gov/articles/PMC4804002/)
22. [istft, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.istft.html)

---
*Topic: Encyclopedia › Technology and the built world › Computing and digital systems › Artificial intelligence and data › Algorithms and computational methods › Numerical, string, and geometric algorithms › Fourier and signal transforms*

*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license
