Harmonic Series Simulator: Visualize Timbre & Overtones

simulator intermediate ~10 min
Loading simulation...
8 harmonics with 1/n amplitude decay at 220 Hz (A3) — sawtooth-like timbre

With 8 harmonics decaying as 1/n at a fundamental of 220 Hz (A3), the combined waveform approximates a sawtooth wave. The spectral centroid sits above the fundamental, giving a bright, string-like timbre.

Formula

f_n = n * f₀ (nth harmonic frequency)
Spectral centroid = sum(n * a_n * f_n) / sum(a_n * f_n)
Sawtooth: x(t) = sum((-1)^(n+1) * sin(2*pi*n*f₀*t) / n)

The Building Blocks of Sound

Every musical sound is a sum of simple sine waves at frequencies that are integer multiples of a fundamental. This harmonic series — discovered mathematically by Joseph Fourier and physically by Hermann von Helmholtz — is the key to understanding why a violin sounds different from a flute playing the same note. The difference is timbre: the recipe of harmonics that defines each instrument's voice.

Harmonic Decay and Instrument Character

The way harmonic amplitudes decrease with frequency determines timbre character. When amplitudes fall as 1/n (where n is the harmonic number), the result approximates a sawtooth wave — bright and rich, like a bowed string. When amplitudes fall as 1/n², the sound is mellow and flute-like, dominated by the fundamental. Equal-amplitude harmonics produce an aggressive, buzzy quality. This simulation lets you hear these differences by watching how individual harmonics combine.

Visualizing the Spectrum

The frequency spectrum shows each harmonic as a bar at its frequency, with height representing amplitude. The combined waveform — the sum of all these sine waves — appears above. As you add more harmonics, the waveform shape becomes more complex and angular. With enough harmonics and 1/n decay, it converges toward a sawtooth; with only odd harmonics, it converges toward a square wave.

Phase and Perception

An often-surprising result: the human ear is largely insensitive to the relative phases of harmonics. Randomizing phases dramatically changes the waveform's visual appearance but barely affects perceived timbre. This is because our auditory system primarily analyzes frequency content (spectral analysis), not waveform shape. The cochlea acts as a biological Fourier analyzer, decomposing sound into its frequency components.

FAQ

What is the harmonic series?

The harmonic series is the set of frequencies that are integer multiples of a fundamental frequency f₀. The first harmonic is f₀, the second is 2f₀, the third is 3f₀, and so on. Every musical instrument produces a unique mix of these harmonics, creating its characteristic timbre.

What determines an instrument's timbre?

Timbre is determined by the relative amplitudes and phases of harmonics present in a sound. A clarinet emphasizes odd harmonics (1, 3, 5...), giving it a hollow sound. A violin has strong even and odd harmonics with 1/n decay. A flute is nearly a pure sine wave with few overtones.

What is a spectral centroid?

The spectral centroid is the amplitude-weighted average frequency of a sound's spectrum. It correlates with perceived brightness — a sound with strong high harmonics has a higher spectral centroid and sounds brighter. It's the most important single number for describing timbre.

Why does 1/n decay sound like a sawtooth?

A perfect sawtooth wave is the sum of all harmonics with amplitudes exactly proportional to 1/n. This is a consequence of Fourier analysis. Similarly, a square wave contains only odd harmonics (1/n for n = 1, 3, 5...). These Fourier series relationships connect waveform shape to harmonic content.

Sources

Embed

<iframe src="https://homo-deus.com/lab/sound-music/harmonic-series/embed" width="100%" height="400" frameborder="0"></iframe>
View source on GitHub