Spectrograms and Time–Frequency Analysis
The short-time Fourier transform, spectrograms, the window-length trade-off, chirps and instantaneous frequency, and a first look at wavelets
14 September 2015 — a chirp from space
At 09:50:45 UTC on 14 September 2015, both LIGO detectors — at Hanford, Washington, and at Livingston, Louisiana, 3002 km apart — record the same brief signal, seven milliseconds apart. In a little over 0.2 seconds it rises, in about eight cycles, from 35 to 250 Hz while it grows in strength: a chirp in the audible range, often compared to a bird's (First observation of gravitational waves).
It is the first direct detection of gravitational waves: two black holes of about 35 and 30 solar masses, some 1.4 billion light-years away, spiralling into one of about 62 solar masses and radiating the missing three as ripples in spacetime.
A spectrum of the whole event would show a smear from 35 to 250 Hz and say nothing of the rising sweep that identifies it. To see a chirp you need frequency and time — and Lesson 4-2 has already told you that you cannot have both exactly.
The short-time Fourier transform slides a window along the signal and takes a DFT at every position. Its squared magnitude, drawn as an image with time across, frequency up and power as brightness, is the spectrogram. Each column is the windowed spectrum of Lesson 6-3, for one moment.
The short-time Fourier transform: a window w advanced by R samples at a time, a DFT at each position; the spectrogram is its squared magnitude.
💡The window-length trade-off
A window of duration resolves frequencies about apart and smears every event over about . Shorten it and time sharpens while frequency blurs; lengthen it and the reverse — the time–bandwidth limit of Lesson 4-2, which no window escapes. In this lesson's lab, two tones 10 Hz apart and a click are analysed twice: a 32 ms window shows the click within 8 ms but merges the tones into one peak, while a 256 ms window separates the tones and smears the click over 88 ms.
💡Chirps and instantaneous frequency
For a signal the instantaneous frequency is . A linear chirp, , has , and its spectrogram is a straight line. The ridge follows only if the frequency changes little within one window. Within a window of length the sweep moves by hertz, while the resolution is ; the two balance at
about 32 ms for a sweep of 1000 Hz per second. A black-hole merger sweeps ever faster as it nears the end, so no single window suits all of it.
Beyond the STFT: wavelets. A fixed window treats all frequencies alike. Many signals do not: their high frequencies come in short bursts and their low frequencies in long tones. A wavelet transform scales its analysing pulse with frequency — short pulses for high frequencies, long ones for low — so it is sharp in time at the top of the spectrum and sharp in frequency at the bottom. Its image is a scalogram. In the lab, a 20 ms burst at 200 Hz stays 19 ms long in the 200 Hz row, analysed by a wavelet ten times shorter than the one that reads a steady 20 Hz tone.
Far better an approximate answer to the right question, which is often vague, than an exact answer to the wrong question, which can always be made precise.
🕰Wavelets from oil prospecting
Jean Morlet, a research engineer at the French oil company Elf Aquitaine, invented wavelets around 1975 to solve signal processing problems in oil prospecting, and coined the word wavelet for the functions he used. From 1981 he worked with the physicist Alex Grossmann to develop what is now the wavelet transform (Jean Morlet).
⚠A spectrogram is a choice
Window length, overlap, window shape and colour scale all decide what a spectrogram shows; two spectrograms of one recording can tell quite different stories. And a spectrogram throws away phase, so the signal cannot be recovered exactly from it. Before reading meaning into a picture, check the settings that made it.
💡Where you will use this
Speech analysis, bird and bat calls, machinery vibration, radar micro-Doppler signatures and gravitational-wave searches all live in spectrograms. FM signals (Lesson 10-2) are chirps by design, and the correlation receivers of Lesson 10-3 detect known waveforms far below the noise.
📚Further reading
- Dennis Gabor, "Theory of Communication", Journal of the IEE, Part III, 93 (1946), 429–457 — the time–frequency plane, and Gaussian windows.
- Stéphane Mallat, A Wavelet Tour of Signal Processing (3rd ed., Academic Press, 2009).
- First observation of gravitational waves on Wikipedia.
↓But there is a problem
Every Fourier method in this course has assumed signals that go on for ever without growing: tones, pulses that die away, noise. A circuit switched on at , or an unstable system whose output grows without bound, has no Fourier transform at all.
In the 1880s Oliver Heaviside solved such problems by treating as though it were an ordinary algebraic quantity. Mathematicians found his methods unrigorous, and the controversy lasted for years — until the Laplace transform showed why they worked.