Rotating harmonics build a repeating wave
The circles show mathematical phase, not a string's literal motion. Their vertical projections add to the oscillating part; A0 shifts the result. Animation runs at 0.2 base cycles per second; sound uses the actual frequency.
- Base period T0 = 1 / f0
- Base angular frequency ω0
- Smallest period of this sum
The harmonic mixer
Harmonic 1
One common period, different numbers of turns
First four harmonicsThe nth harmonic completes n turns in T0, so Tn = T0 / n. Its phase returns after T0 even if that harmonic's own shortest period is smaller. These unit-amplitude reference harmonics are separate from the mixture's amplitudes and phases.
From repeating motion to a Fourier series
Why these frequencies line up
A sinusoid must advance by a whole number of turns to return to its starting phase. Requiring that return after T0 gives ωT0 = 2πn, hence ω = nω0. Integer harmonics therefore share a common period, and adding them preserves that period.
The common period need not be the smallest one. Only harmonics 2 and 4 give T0 / 2. Harmonics 2 and 3 still need T0, despite having no first-harmonic component. A constant alone has no smallest positive period. Distinct incommensurate frequencies, such as 2 and √2 rad/s, have no common finite period; they are not included in this integer-harmonic mixer.
Amplitude, phase, sine and cosine
One harmonic can be written in two equivalent forms:
An cos(nω0t) + Bn sin(nω0t)
= Rn cos(nω0t − δn)
Here Rn = √(An2 + Bn2), An = Rn cos δn, and Bn = Rn sin δn. A 90° phase gives a positive sine. Changing phase changes the shape without changing that component's frequency or amplitude. At zero amplitude, phase has no physical meaning.
A0 is the mean level. In the conventional infinite-series notation it is a0 / 2, not a0.
More harmonics, finer details
N is the highest harmonic retained, not the count of nonzero components. A square-wave preview uses odd sine coefficients 4 / (πn); the even ones vanish. Triangle-wave coefficients fall as 1 / n2, while the sawtooth uses every sine harmonic with alternating signs.
Finite sums are smooth and cannot make a true jump. Square and sawtooth approximations ring near jumps: increasing N narrows the ringing region but does not drive the limiting overshoot height to zero. At a jump the ideal reference marks the midpoint. The presets illustrate synthesis; deriving their coefficients and proving convergence belong to later Fourier articles.
What reaches the speaker
The sound is the selected finite sum, with its DC term removed. Cosine and sine coefficients go directly into the browser's Web Audio periodic-wave synthesizer. A conservative level scale and short fades avoid clipping and abrupt start/stop clicks; graph amplitudes are not normalized.
Frequency changes pitch. Relative harmonic strengths change timbre. Phase can change waveform shape without an equally obvious perceptual change; equal sound-level settings are not equal perceived loudness. Above 45% of the audio sample rate, components are omitted from sound only. Exported WAV files use 48 kHz, mono 16-bit PCM.
Julia independently computes the reference curves and generates the downloadable WAV. The interactive page runs locally, with no server-side Julia or microphone access.