Spectrogram
What Is a Spectrogram?
A spectrogram is a two-dimensional representation of a signal's frequency content as it changes over time, displaying time on one axis, frequency on the other, and signal intensity at each time-frequency point encoded as color or brightness. The technique bridges the time-domain view provided by a waveform and the frequency-domain view provided by a static power spectrum, giving analysts both dimensions simultaneously. Spectrograms are foundational to speech processing, acoustics, radar, sonar, and biomedical signal analysis, among other fields.
The spectrogram is computed from the short-time Fourier transform (STFT), a method that applies a sliding analysis window to a signal, computes the discrete Fourier transform (DFT) within each window, and assembles the resulting frequency spectra into a time-ordered sequence. The squared magnitude of the STFT at each time-frequency point yields the spectrogram value, as described in IEEE research on spectrogram-based modulation classification. In medical imaging, the same time-frequency visualization applied to ultrasound echo signals is called a sonogram; the underlying mathematics is equivalent, though the domain-specific terminology differs.
Short-Time Fourier Transform and Resolution Trade-offs
The STFT is the computational backbone of spectrogram generation. A windowing function, typically Hann, Hamming, or Kaiser, is multiplied with successive overlapping frames of the signal before the DFT is applied. Window length directly governs the resolution trade-off: a longer window improves frequency resolution but blurs rapid temporal changes, while a shorter window captures fast events at the cost of spectral detail. Aalto University's Introduction to Speech Processing provides a detailed treatment of how this trade-off affects the readability of speech spectrograms, including the visibility of formant transitions and consonant boundaries. Overlap between successive frames, typically 50 to 75 percent, smooths the time axis and prevents aliasing artifacts in the final image.
Reading Spectrograms
A spectrogram image encodes several properties of the underlying signal simultaneously. Horizontal striations at regular frequency intervals indicate harmonic structure, characteristic of periodic sounds such as voiced speech or musical tones. Vertical smearing indicates broadband transients such as plosive consonants or mechanical impacts. The NTIA research on short-time Fourier transform coefficients in audio signals demonstrates how the statistical properties of STFT coefficients vary across signal types, which informs both codec design and classification systems. Color maps in digital spectrograms conventionally assign brighter or warmer colors to higher spectral power, though the choice of map and dynamic range significantly affects what features are perceptually salient.
Spectrogram Variants and Extensions
Several variants of the basic spectrogram address specific analytical needs. The mel-frequency spectrogram maps the frequency axis to the mel scale, a perceptual scale that approximates how the human auditory system processes pitch, and is the input representation used in most modern speech recognition and audio classification systems. Research on spectrogram analysis of speech signals describes how the generalized S-transform produces a spectrogram with frequency-dependent resolution, offering better time localization at high frequencies than a fixed-window STFT. The Wigner-Ville distribution and Cohen's class of time-frequency representations offer sharper localization but introduce cross-terms that complicate interpretation when multiple signal components overlap.
Applications
Spectrograms have applications in a wide range of disciplines, including:
- Speech recognition and speaker identification
- Audio codec design and quality evaluation
- Radar and sonar target classification
- Seismology and structural health monitoring
- Biomedical signal analysis including electroencephalography and echocardiography