Spectrograms
A spectrogram is a plot that allows us to visualize the time-dependent frequency content of sound. It shows which frequencies are present, how strong each one is, and how these change over time.
To build one, the sound is chopped into short slices (windows) and the frequency content of each slice is found through a Fourier transform. Each frequency spectrum is mapped onto a column of colors (encoding the “strength” of each frequency), with low frequencies at the bottom and high ones at the top. These columns then scroll past as time progresses.
Altogether, we are left with an animated graph:
- the horizontal axis is time, with the present moment at the right edge
- the vertical axis is frequency, low at the bottom
- color is level, how strong that frequency was at that moment
Everything below happens inside your browser. No audio is uploaded, stored, or recorded.
Live Spectrogram
Sing, whistle, or play an example sound and watch its frequencies scroll past. Turn on measurements to read exact values.
This interactive didn't load.
Reload the page. If it keeps happening, especially on a school network, the site's files may be filtered. The connection check can tell you what's blocked.
Things worth trying:
- Whistle, and slide your pitch up and down
- Say “ssss”, then “ahhh”
- Play the harmonic stack and find the relationship between the prominent frequencies
- Listen to some birdsong
There are many patterns to be found in natural (and synthesized) sounds. A steady horizontal line is a constant tone with one frequency. A collection of evenly spaced lines is known as a harmonic stack. A vertical streak is a click, handclap, or some other percussive sound.
Note that many instruments, including your voice, do not produce a single frequency. They often produce a harmonic stack: a fundamental frequency together with harmonics at integer multiples . A first-year physics course will usually explain the mechanism by which these harmonics are produced.
The quietest sound you can hear and a sound loud enough to hurt differ in amplitude by a factor of around a million. With a linear “loudness scale”, it is difficult to visually distinguish between quiet and loud. So the scale is logarithmic, measured in decibels:
Every is a factor of ten in amplitude. In the spectrogram, the Floor control sets where the color scale bottoms out: raise it to remove background noise, leaving only the strong components.
Likewise, the vertical frequency axis is also logarithmic. Equal frequency ratios take equal space, so every octave is the same height and a musical interval becomes a fixed distance no matter where on the display it sits.
The Gabor Limit
The spectrogram does not consider the entire data set at once. It looks at samples (the window) at a time, taken at a sample rate . That window lasts
and it cannot distinguish two frequencies closer together than
Multiply them and the and both cancel:
A short window pins down when something happened at the cost of frequency resolution. A long window better resolves the frequency content but loses temporal resolution.
This is the Gabor limit, and it is not a limitation of this particular analyzer or of computers in general. It is a theorem about signal processing, and it is the same mathematics that reappears later as the uncertainty principle in quantum mechanics.
Problem Solving
Reading a Harmonic Stack
Reading a Harmonic Stack
Problem
A frozen spectrogram shows bright horizontal lines at , , , and , and nothing below . What note is sounding?
Use
Harmonics sit at integer multiples of the fundamental,
so the spacing between neighbouring lines is itself the fundamental.
Solve
The gaps are , , and . So , and the four lines are through . Converting to a note,
which is E3.
Check
The lines are equally spaced in hertz but not in ratio, so on the log axis they crowd together going up — the signature of one instrument rather than four unrelated tones.
Choosing a Window
Choosing a Window
Problem
Two tones apart are playing, slow enough that you hear them beat. The sample rate is . Will a -point window show them as two separate lines?
Use
Solve
which is far coarser than the gap, so both tones land in the same resolution cell and paint a single thick line that pulses. Separating them needs
samples, so even the -point window is not quite enough — and it already spans .
Check
The pulsing is the beat itself, showing up on the time axis precisely because the frequency axis could not hold it.
Spectrogram Checkpoint1 of 3