opyeb WaveLab

Guides · Fourier

The square wave: odd harmonics, 1/n amplitudes, and a stubborn overshoot

Basis 28 Nov 2026 · Fourier analysis · 7 min read

A square wave alternating between +1 and −1 V is the standard first example, because its coefficients are simple and its failure mode is visible. Its Fourier series contains only odd harmonics, with amplitudes falling as 1/n and alternating sign in the cosine form.

y(t) = (4/π)[ sin ωt + sin 3ωt / 3 + sin 5ωt / 5 + … ], ω = 2π f₀

In the synthesiser the same series appears normalised to the first harmonic: a₁ = 1, a₃ = 1/3, a₅ = 1/5, all with phase 0°, and every even harmonic at zero. That is exactly the Square preset.

What the partial sums do

With one term you have a sine. With three the top flattens and a step appears. With five the edges steepen. The interesting part is the peak: the first harmonic is held at 1 V, so the finished square stands at 4/π ≈ 0.785 V, and the peak of the partial sum settles at 0.926 V — 8.95 % of the 1.571 V jump above the plateau, on both sides of every edge. Adding terms makes the overshoot narrower but not shorter.

Harmonics usedPeak of the sumTHD
11.000 V0 %
3 (1, 3, 5)0.943 V33.3 %
5 (1…9, odd)0.933 V38.9 %
6 (1…11, odd)0.928 V43.8 %
∞0.926 V48.3 %

The peak barely moves as harmonics are added because two things happen at once: the plateau rises towards 0.785 V while the ringing stays about 9 % above it. The limit is 0.926 V = 1.179 × 4/π.

Why the overshoot survives

The series converges pointwise, so at every point away from the jump the values approach the square wave. But convergence is not uniform near a discontinuity: the partial sums always contain a fixed-size ripple whose first lobe sits at about t = T/2N. Its height as a fraction of the jump tends to (2/π)∫₀^π sin(x)/x dx − 1 ≈ 0.0895. That is the Gibbs phenomenon, and it is a property of the truncated series, not of any real amplifier.

This matters when a square wave is used as a test signal. A digital square wave sampled at 48 kHz and reconstructed with a band-limited filter shows the same ripple; a real square wave from a comparator does not, because it has no band limit to truncate. If a scope shows 9 % overshoot on a digital square, the source is usually the reconstruction filter, not a fault.

Where the missing distortion lives

An ideal square has THD of 48.3 %, computed from Σ 1/n² over odd n ≥ 3 divided by 1. With harmonics up to the 11th the bench shows 43.8 %: the remaining 4.5 points sit in the 13th and above. That is also why a 1 kHz square sounds duller than the maths suggests once it passes through a 20 kHz-limited path — the 21st harmonic and beyond are gone.

THD_square = √(Σ_{n odd ≥ 3} 1/n²) = √(π²/8 − 1) = 0.4834

Try it in the studio

Set Square at 220 Hz, then drag harmonic 3 to zero. The flat top becomes a rounded hump and the peak jumps from 0.93 V to 1.10 V: the shape is no longer square, so its own overshoot is a larger fraction of its plateau. Restore it, then set harmonic 2 to 0.5 V with phase 90°: the peak rises to 1.37 V and the crest factor climbs, which is what a phase-shifted second harmonic does to any signal.

Questions

Does a real square wave overshoot by 9 %?

A generated square wave that has been band-limited does. A comparator output switching between two rails has no such ripple; it may ring for other reasons, but not with the 8.95 % figure.

Why is the peak 0.93 V and not 1 V?

Because the sliders set harmonic amplitudes, not the height of the finished wave. A square of 1 V amplitude needs a first harmonic of 4/π = 1.273 V; with 1 V the plateau is 0.785 V and the Gibbs peak 0.926 V. The ratio, not the absolute height, is what the preset is about.

Open the synthesiser, choose Square, and compare the peak readout with 3, 5 and 12 harmonics.

Open the studio

Written from standard Fourier analysis, digital signal processing and acoustics; the worked numbers can be reproduced in the studio linked above.

Back to the guides