# 短时傅里叶变换

短时傅里叶变换（STFT）是一种信号处理变换，它将信号分成连续的短段，加窗后计算每段的[傅里叶变换](https://www.edgepedia.org/zh/fourier-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>

| 关键事实 | 详情 |
|---|---|
| 定义 | 对连续信号 \( x(t) \)，\( S(f,t) = \int x(\xi)\, \overline{w(\xi-t)}\, e^{-j2\pi f \xi}\, d\xi \)，即信号与一个在时间上平移、在频率上调制的窗的内积<sup>[3](https://docs.scipy.org/doc/scipy/tutorial/signal.html)</sup> |
| 起源 | 由丹尼斯·盖博（Dennis Gabor）于1946年提出，用于测量声音的时间局部化频率<sup>[2](https://nd.psychstat.org/_media/lab/handbook_of_computational_statistics.pdf)</sup> |
| 分辨率权衡 | 时频分辨率在整个平面上固定，且下界为 \( \Delta\omega\,\Delta t \ge 1/(4\pi) \)；高斯窗取等号<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> |
| 关键参数 | 帧长 \( N_F \) 决定频率分辨率 \( \Delta f = f_s / N_F \)；帧移 \( N_H \) 决定时间分辨率和计算成本，但不影响频率分辨率<sup>[4](https://www.cs.cmu.edu/~15322/book/ch10/04.html)</sup> |
| 逆变换 | 逆STFT对每帧做逆FFT，再将结果重叠相加；完美重构需要满足非零重叠相加（NOLA）条件<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> |
| 常见默认值 | librosa.stft 使用 \( n_{\text{fft}} = 2048 \) 个采样点和512的帧移，即在22050 Hz下为93毫秒帧长和23毫秒帧移，产生1025个频率格点<sup>[6](https://librosa.org/doc/main/auto_tutorials/01-intro/02-frequency.html)</sup> |
| 典型用途 | 频谱图、相位声码器、滤波与滤波器组，以及机器学习音频模型的输入特征<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> |

## 定义与解释

STFT 解决了普通傅里叶变换的一个局限：后者对整个时间轴积分，因而丢弃了每个频率出现的时间。对于音乐、语音及其他非平稳信号，频率成分随时间变化，单一的全局频谱不够用。<sup>[4](https://www.cs.cmu.edu/~15322/book/ch10/04.html)</sup>

该变换通过将信号乘以窗函数 \( w(t) \)（一个紧支撑或快速衰减的函数，如汉宁窗或高斯窗），再对乘积做傅里叶变换，从而在时间上局部化信号。将窗沿信号滑动并重复此过程，便得到同时关于时间和频率的函数：<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 \]

这可以从两个角度理解。作为加窗频谱，它是中心在时刻 \( t \) 的片段 \( x(\tau) w(\tau - t) \) 的傅里叶变换。作为滤波器组，它用一个带通滤波器对信号滤波，该滤波器的冲激响应是调制到频率 \( f \) 的窗；当窗与其傅里叶变换构成变换对时，这两种视角是等价的。<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>

对于采样间隔为 \( T \) 的采样信号 \( x[k] = x(kT) \)，离散 STFT 在网格 \( S[q,p] = S(q\,\Delta f,\, p\,\Delta t) \) 上计算 \( S \)。在典型实现中，第 \( p \) 列是以时间 \( t[p] = p \cdot \text{hop} \cdot T \) 为中心的窗的 FFT，第 \( q \) 行是频率 \( f[q] = q \cdot \Delta f \) 处的值，频率格点宽度为 \( \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>

## 时频分辨率与不确定性原理

由于在每个频率上使用相同的窗，STFT 的分辨率在整个时频平面上是固定的。窄窗给出好的时间分辨率，但会模糊频率；宽窗能分辨相近的音调，但会在时间上涂抹事件。两种分辨率的乘积由不确定性关系给出下界<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>

高斯窗取等号，因此是时频分辨率最优的窗。两个频率的间隔必须大于 \( \Delta\omega \) 才能被分辨，两个脉冲的间隔必须大于 \( \Delta t \) 才能被分辨。这种固定的铺砌意味着 STFT 不适合需要同时在高低频都有精细分辨率的信号。<sup>[1](https://www.its.ntia.gov/umbraco/surface/download/publication?reportNumber=93-302.pdf)</sup>

**参数选择。** 在离散实现中，两个可调参数是帧长 \( N_F \) 和帧移 \( N_H \)。较长的帧使 DFT 的频率格点更紧密，\( \Delta f = f_s / N_F \)，以时间分辨率为代价改善频率分辨率；当帧覆盖整个信号时，STFT 退化为单一的全局 DFT。帧移完全不改变频率分辨率；它控制每秒产生多少帧，因而影响计算成本，因为 \( N \) 个采样点产生 \( N/N_H \) 帧。常见做法是使用2的幂次帧长以提高 FFT 效率，并使用足够长的帧以覆盖感兴趣的最低频率的至少一个周期；在44.1 kHz下，4096个采样点的帧（约93毫秒）覆盖了人类听觉的20 Hz下限。<sup>[4](https://www.cs.cmu.edu/~15322/book/ch10/04.html)</sup>

## 逆变换与完美重构

逆 STFT 反转分析过程：对每个时间切片做逆 FFT，乘以合成（对偶）窗，将结果移回原始时间位置，再对移位后的片段做重叠相加。当分析窗在所选帧移 \( R \) 下满足恒定重叠相加（COLA）约束时，重构是精确的，<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} \]

其中 \( c \) 是非零常数，\( a = 0 \) 对应普通重叠相加（OLA），\( a = 1 \) 对应加权重叠相加（WOLA）。弱 COLA 合规依赖于频域中的混叠消除，仅对未修改的频谱给出完美重构；强 COLA 合规还要求窗的傅里叶变换带限于 \( f < 1/(2R) \)，从而不发生混叠，在短时频谱被修改时（如音频效果中）更受青睐。一个有用的 WOLA 窗可以构造为强 OLA 窗的平方根，根汉宁窗是标准例子。<sup>[5](https://www.mathworks.com/help/signal/ref/istft.html)</sup>

## 应用

**频谱图。** 最熟悉的应用是频谱图，一种以颜色或强度表示功率的时频图。该术语既泛指此类图，也特指 STFT 的模的平方。<sup>[7](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ShortTimeFFT.html)</sup> 基于频谱图的特征在深度学习音频系统的输入表示中占主导地位，因为它们将声音呈现为二维图像，卷积网络可直接处理。<sup>[11](https://arxiv.org/abs/2603.14917)</sup>

**相位声码器与音频效果。** 相位声码器最初以滤波器组实现，利用 STFT 的短时幅度和相位频谱来变换声音：时间拉伸、音高偏移、去噪和成分分离都通过修改二维表示并重新合成来实现。<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> 相位声码器利用纯幅度频谱图所忽略的相位信息来改进频率估计。<sup>[14](https://sethares.engr.wisc.edu/htmlRT/vocoders/phasevocoder.html)</sup>

**语音与机器学习。** STFT 是单声道语音分离方法（如深度聚类和置换不变训练）的标准前端。<sup>[8](https://arxiv.org/abs/1902.00631)</sup> 在卷积神经网络环境声分类输入表示的比较研究中，梅尔尺度短时傅里叶变换略优于恒Q变换、连续小波变换和基线梅尔频率倒谱系数特征，最优窗大小取决于信号。<sup>[15](https://arxiv.org/abs/1706.07156)</sup>

## 替代方案与变体

固定窗是 STFT 的主要结构性局限，有若干变换族来解决它。恒Q变换以恒定的 Q 因子按几何级数排列其频率格点，与音乐音高和人类听觉系统的频率分辨能力相匹配；它最初是为音乐分析提出的。<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> 小波变换以恒定相对带宽而非恒定带宽划分时频平面，给出尺度自适应分辨率，更好地对齐某些信号结构。<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> 在 STFT 族内部，自适应 STFT 根据局部信号特性调整窗大小，多分辨率 STFT 用不同窗大小处理不同频带；多尺度 STFT 结合两者，在时间和频率上调整窗以匹配各成分的瞬态性。<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>

**软件实现。** 在 SciPy 中，较新的 `ShortTimeFFT` 类提供参数化的离散 STFT 及其逆变换，默认使用最小能量的规范对偶窗；较旧的 `stft` 函数是遗留版本，不再接收更新。<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> 在 librosa 中，`stft` 默认使用2048个采样点的帧和512个采样点的帧移，在默认22050 Hz采样率下为93毫秒和23毫秒，语音推荐使用512；较小的帧移增加时间列数而不影响频率分辨率。<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)

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

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods › Numerical, string, and geometric algorithms › Fourier and signal transforms

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/short-time-fourier-transform

English original: https://www.edgepedia.org/short-time-fourier-transform
