Time-Domain Waveform

Spectrogram (STFT)

Time (s) Frequency (Hz)

Energy Density Legend

0 dB -80 dB
Signal Length --
STFT Frames --
Frequency Bins --
Freq Resolution --
Time Resolution --
Overlap --

Understanding Spectrograms

What is a Spectrogram?

A spectrogram is a visual representation of the spectrum of frequencies in a signal as it varies with time. It is computed using the Short-Time Fourier Transform (STFT), which divides the signal into overlapping segments, applies a window function, and computes the FFT for each segment.

Time-Frequency Resolution Trade-off

The window size controls the fundamental trade-off between time resolution and frequency resolution. A larger window provides better frequency resolution but poorer time resolution. This is a manifestation of the Heisenberg uncertainty principle in signal processing.

Window Functions and Spectral Leakage

When the STFT extracts finite-length segments, discontinuities at the boundaries cause spectral leakage. Window functions taper the signal at edges to reduce this effect. Hann provides good balance, Blackman has stronger side-lobe suppression, and Rectangular has the worst leakage.

Applications

Speech Recognition: Spectrograms reveal formant patterns that characterize vowels and consonants.
Music Analysis: Identify instruments, notes, chords, and timbral characteristics.
Seismology: Analyze earthquake waves and study Earth's interior structure.
Radar and Sonar: Detect moving targets by analyzing Doppler frequency shifts.
Medical Diagnostics: Analyze heart murmurs, EEG patterns, and ultrasound signals.

STFT Mathematical Definition

STFT{x[n]}(m, k) = SUM(n=0 to N-1) x[n + mH] w[n] e^(-j2pi kn/N)

Where x[n] is the input signal, w[n] is the window function, N is the window size, H is the hop size, m is the frame index, and k is the frequency bin index.

How to Use This Tool

  1. Select a signal type and adjust its parameters.
  2. Alternatively, upload an audio file for analysis.
  3. Adjust STFT parameters: window size controls frequency vs. time resolution trade-off.
  4. Choose a colormap and frequency scale that best reveals the features.
  5. Hover over the spectrogram to inspect time-frequency energy at any point.