Complex sounds as sums of sinusoids: building a tone from harmonics, computing Fourier coefficients, and following a spectrum through time.
p(t) = Σₙ Aₙ sin(2πn f₁ t + φₙ), n = 1…8
Do we hear phase? Press Randomise phases while the tone plays: the waveform changes shape completely, the peak and the crest factor jump around, but the spectrum and the rms stay put, and for a steady tone the sound is essentially the same. That is the Ohm–Helmholtz view: timbre is set mostly by the amplitudes of the partials. The slide-6 table in dB means amplitudes 1, 0.10 and 0.32, not the 1, ⅓, ⅔ drawn in the figure. The clarinet preset uses odd harmonics, the signature of a pipe closed at one end.
f(t) = ½a₀ + Σ [aₙ cos nωt + bₙ sin nωt]
bₙ = (2/T)∫₀ᵀ f(t) sin(nωt) dt, T = 2, ω = π
1 · Vectors. The x-component of a vector v is its projection on the unit vector x̂: multiply component by component and add, vx = v·x̂ = Σᵢ vᵢ x̂ᵢ. For a basis vector e that is not of unit length, divide by its squared length: component = (v·e)/(e·e).
2 · Functions as vectors. Sample f(t) at many instants and it becomes a long list of numbers, a vector. The dot product of two functions is then the sum of the products of their samples, which in the limit of fine sampling is an integral: ⟨f, g⟩ = ∫₀ᵀ f(t) g(t) dt. Tick dot product of 16 samples to see the sum of bars approach the integral.
3 · The Fourier coefficient is a component. bₙ = ⟨f, sin nωt⟩ / ⟨sin nωt, sin nωt⟩. The denominator is ∫₀ᵀ sin²(nωt) dt = T/2, which is where the factor 2/T in the formula comes from. The thick curve in the panel above accumulates the integral from 0 to t; its end value at t = T is bₙ.
4 · Why each coefficient can be found on its own. The basis functions are orthogonal, like x̂, ŷ, ẑ: ⟨sin mωt, sin nωt⟩ = 0 for m ≠ n, and the sines are orthogonal to all cosines (left panel below). Projecting onto sin nωt therefore picks out bₙ alone, untouched by all the other terms. This is the same orthogonality of eigenfunctions met in the Sturm–Liouville slide of the Modes lecture.
Gibbs. Near a jump the partial sum overshoots by about 9% of the jump (1.179 for this square wave) whatever N is; adding terms only squeezes the overshoot closer to the discontinuity. Tick Coarse sampling to see why the n = 1000 MATLAB plot looked clean: with 20 samples per period the narrow overshoot falls between samples. Projection: for the square wave the positive and negative areas of f(t)·sin(nωt) cancel exactly for even n, so b₂ = b₄ = … = 0. Decay (log–log, right): a jump gives |bₙ| ∝ 1/n, a kink (triangle, plucked string) gives 1/n², which is why a plucked string sounds mellower than a square wave. For the pluck, bₘ = 2 sin(mπx₀/L)/[m²π² (x₀/L)(1 − x₀/L)].
The spectrogram slides a window of length Δt along the record and takes the spectrum of each piece. Its frequency resolution is about Δf ≈ 1/Δt.
Try the two close tones: with a short window they merge into one band that pulses (beats); with a window longer than about 1/15 s ≈ 70 ms they split into two steady lines. The clicks do the opposite: only a short window separates the two clicks 20 ms apart. You cannot have both, Δt·Δf stays of order one. The dispersed wave train imitates a surface-wave record in which low frequencies travel faster and arrive first: the spectrogram shows frequency rising with arrival time, the group-delay curve that frequency–time analysis (FTAN) picks out to measure dispersion.