Time-frequency and images · Definition
Short-time Fourier transform
Before you start you need to know
A single DFT averages the frequency content over the whole signal and loses time information. The STFT addresses this by analyzing local segments of the signal.
Definition
The short-time Fourier transform (STFT, \( X(\tau,\omega) \)) describes how the frequency content of a signal varies over time using a sliding window.
The STFT is linear in \( x[n] \), and its squared magnitude is the spectrogram. Shifting the window \( w[n] \) by \( \tau \) yields a family of local spectra indexed by time. Reconstruction is possible under suitable overlap conditions (the COLA condition), and the product of time and frequency resolutions is bounded by the uncertainty principle.
Consider \( x[n]=\cos(2\pi\,0.1\,n)\) for \( n<100 \) and \( x[n]=\cos(2\pi\,0.3\,n)\) for \( n\ge 100 \), with a rectangular window of length 32. STFTs centered at \( n<100 \) show a peak near \( \omega=0.2\pi \), while those centered at \( n\ge 100 \) show a peak near \( \omega=0.6\pi \). The spectrogram thus reveals the frequency change that a global DFT would blend together.
A typical mistake is using a window that is too long, which blurs the temporal change so both frequencies appear mixed in the same frames. Another common error is forgetting that the STFT is redundant when the overlap is large, so not all coefficients are independent.
Think about it
Why does a large overlap make the STFT redundant?
Because consecutive frames share samples, so their coefficients are correlated and not independent.
Exercises 10
- What does the squared magnitude of the STFT represent?
- Which variable does the window \( w[n] \) shift over in the STFT definition?
- Is the STFT a linear operation with respect to the signal \( x[n] \)?
- What type of window is \( w[n] \) when it equals 1 on a finite interval and 0 outside?
- What is the name of the condition that allows reconstructing the signal from the STFT with adequate overlap?
- A signal equals \( x[n]=\cos(2\pi\,0.25\,n) \) for all time. At what normalized frequency does the peak of its STFT appear in any frame?
- A window of length \( L=64 \) is shifted by hop \( R=16 \). What is the overlap in samples between consecutive frames?
- If the STFT is computed with \( L=256 \) and \( R=128 \), what is the approximate redundancy factor relative to the original signal?
- A 1024-sample signal is analyzed with an STFT of window \( L=128 \) and hop \( R=64 \), with no padding. How many complete frames are obtained?
- A signal \( x[n] \) has an STFT with a rectangular window of length \( L=32 \). Suppose \( x[n]=\cos(2\pi\,0.2\,n) \) for \( n<64 \) and \( x[n]=\cos(2\pi\,0.2\,n)+\cos(2\pi\,0.4\,n) \) for \( n\ge 64 \). Which statement about the spectrogram on \( n\in[80,112) \) is correct?
References
- Alan V. Oppenheim, Alan S. Willsky, Signals and Systems, 2nd edition, Pearson, 1996.
- Alan V. Oppenheim, Ronald W. Schafer, Discrete-Time Signal Processing, 3rd edition, Pearson, 2010.