← Lab

Spectrogram
Frequency spectrum
Frequency 440 Hz
Volume 50%
Waveform
FFT size
Color scheme
Max frequency 8000 Hz
Gain (dB) 0 dB

Fourier analysis

Any signal can be decomposed into a sum of sine waves at different frequencies — this is the Fourier transform, one of the most important ideas in mathematics. The spectrogram computes a Short-Time Fourier Transform (STFT): it takes small windows of the audio signal and computes the frequency content of each window. The result is a 2D image where the x-axis is time, the y-axis is frequency, and the color represents amplitude at that time-frequency point.

The frequency domain

A pure sine wave appears as a single horizontal line on the spectrogram. A square wave contains odd harmonics (1x, 3x, 5x, 7x...) so you see multiple lines. A sawtooth wave contains all harmonics. Speech and music create rich, time-varying patterns. The frequency spectrum (bar chart below the spectrogram) shows a snapshot of the current frequency content — a single vertical slice through the spectrogram.

How our ears work

The cochlea in your inner ear performs essentially the same operation as this spectrogram. The basilar membrane resonates at different positions for different frequencies — high frequencies near the base, low frequencies near the apex. Your brain receives a spectral decomposition of the sound, which is why we perceive pitch, timbre, and harmony rather than raw air pressure oscillations. The logarithmic frequency option here roughly matches how the ear spaces frequencies perceptually.

The FFT

The Fast Fourier Transform (FFT) is the algorithm that makes this possible in real time. Published by Cooley and Tukey in 1965 (though Gauss used the idea in 1805), it computes the Discrete Fourier Transform in O(n log n) instead of O(n²) time. Larger FFT sizes give better frequency resolution but worse time resolution — an unavoidable tradeoff known as the uncertainty principle of signal processing.