Mathematics · Simulator 043
Add sine waves together, one harmonic at a time, and watch a square, sawtooth or triangle wave emerge. Set your own harmonic amplitudes, compare the waveform with its frequency spectrum, and find the stubborn overshoot at sharp jumps.
Any reasonable periodic signal can be written as a sum of sines and cosines at whole-number multiples of its fundamental frequency (a Fourier series):
f(t) = Σₙ bₙ sin(2π n t / T)
The smoother the wave, the faster its harmonics shrink. At a jump, partial sums always overshoot by about 9% of the jump, however many terms you add. This is the Gibbs phenomenon: the overshoot gets narrower but not shorter.
The spectrum chart shows |bₙ| for each harmonic (a line spectrum). In audio, these harmonics are what make a note sound like a flute (few harmonics) or a buzzy synthesiser (many).
Sine-only (odd-symmetric) series; the custom mode lets you set the first eight amplitudes. No sound is played.
A square wave and a triangle wave both have the fundamental amplitude b₁ at n = 1. How much weaker is the 9th harmonic than the fundamental in each?
Square: bₙ ∝ 1/n, so the 9th is 1/9 ≈ 11% of the fundamental. Triangle: bₙ ∝ 1/n², so 1/81 ≈ 1.2%. That is why a triangle wave sounds much softer and purer than a square wave at the same pitch.