d8098edAn interactive tutorial on the wave equation in acoustics: strings, drums and rooms, measured by earJeremy Magland 1Before any numerical method, we want a string whose motion we know exactly, and a way of turning that motion into sound. This chapter builds both, and in doing so meets the first error of the tutorial. It is not an error of any method: it is what happens when an exact solution is played as it stands.
3### Two exact solutions
5Take a string of length 1, fixed at both ends, pulled aside at $x = \beta$ into a triangle of height 1 and released from rest. Its displacement obeys $u_{tt} = c^2 u_{xx}$ with $u(0,t) = u(1,t) = 0$, and there are two classical ways of writing down the answer.
7**d'Alembert's.** Every solution of the wave equation on a line is a sum of a shape moving right and a shape moving left. Extend the initial triangle to the whole line as an odd function about 0 and about 1, which makes it periodic with period 2, and call the result $\phi$. Then
9$$u(x,t) = \tfrac12\big(\phi(x - ct) + \phi(x + ct)\big)$$
11satisfies the equation, the initial conditions and both boundary conditions: the odd extension is what makes the two halves cancel at the ends. Half the triangle travels each way, reflects inverted from each end, and the two halves recombine into the original shape once per period $2/c$.
13<!--fig:dalembert-->
15**Fourier's.** Alternatively, expand the initial shape in the eigenfunctions of the problem, $\sin(n\pi x)$. Each one oscillates on its own at frequency $n f_0$, with $f_0 = c/2$, so
17$$u(x,t) = \sum_{n=1}^{\infty} A_n \sin(n\pi x)\cos(2\pi n f_0 t), \qquad A_n = \frac{2\sin(n\pi\beta)}{n^2\pi^2\beta(1-\beta)}.$$
19The partials are exactly harmonic, at whole multiples of the fundamental. Their amplitudes fall like $1/n^2$, and $\sin(n\pi\beta)$ removes every partial with a node at the plucking point: plucked at $\beta = 1/5$, the string has no 5th, 10th or 15th harmonic.
21The two forms share no algebra, and the lab below computes the modal sum with the editable script and d'Alembert's form with the driver, so that each checks the other.
23### What is heard
25A listener does not hear $u$. An acoustic guitar is heard through its body, which is driven by the force the string exerts on the bridge, and that force is proportional to the slope $u_x(0,t)$. Differentiating the modal sum multiplies each amplitude by $n\pi$, so the bridge force has partials that fall like $1/n$, and in d'Alembert's form it is $\phi'(ct)$, a rectangular pulse train: $1/\beta$ for a fraction $\beta$ of each period and $-1/(1-\beta)$ for the rest. An electric guitar is heard through a magnetic pickup, which reports the displacement at one point $x_p$, and its partials fall like $1/n^2$ with a second set of gaps where $\sin(n\pi x_p)$ vanishes. The lab offers both.
27For listening, the script also applies a loss: each partial decays by 60 dB in $3/(1 + (f/2000)^2)$ seconds, so that high partials die first, roughly as they do on a real string. This is a model of taste rather than of physics, and it is switched off whenever the modal sum is compared with d'Alembert's solution.
29<!--lab:pluck-->
31At $f_0 = 110$ Hz there are 200 partials below the Nyquist frequency of 22.05 kHz, and at $\beta = 0.2$ exactly 12 of the first 60 are missing. Moving the pluck towards the middle removes more of them, and at $\beta = 0.5$ every even harmonic is gone, which is the hollow, clarinet-like sound of a string plucked at its centre. The waveform panel shows the band-limited modal sum at the sample instants against d'Alembert's rectangular pulses, and they differ in the way any truncated Fourier series differs from a discontinuous function: by ringing at the jumps. That ringing is the whole of the relative rms difference printed above the figures, $5.0\times10^{-2}$ for the bridge force and $3.5\times10^{-4}$ for the smoother pickup signal.
33### Sampling an exact solution
35The rms difference between the two exact solutions raises a question. Both are exact. Which should be played?
37The answer is the modal sum, and the reason is sampling. A digital signal at 44.1 kHz can represent frequencies up to 22.05 kHz and no higher. A component at frequency $f$ above that limit does not disappear when it is sampled: it produces exactly the same samples as a component at $|f - k f_s|$ for the integer $k$ that brings it below the limit. This is **aliasing**, and the component is said to *fold* back into the audible band. d'Alembert's bridge force has corners, so it has partials at every multiple of $f_0$ however high, and reading it off at the sampling instants folds all of those above 22.05 kHz back down. The modal sum stopped at the Nyquist frequency has none.
39<!--fig:folding-->
41A folded partial lands at $|n f_0 - k f_s|$, which is a multiple of $f_0$ only when $f_s/f_0$ happens to be a whole number. Otherwise it lands between the harmonics, where it is heard as a tone that does not belong to the note.
43<!--lab:alias-->
45The energy that folds is known in advance. It is the energy of the partials above the Nyquist frequency, which for the bridge force is the total, $1/(\beta(1-\beta))$ by Parseval's theorem, minus the sum over the partials below. The measured energy of the difference between the two sampled signals agrees with this to within 0.03 dB for every note in the table below but one.
47| note | $f_0$ | bridge force | pickup |
48|---|---|---|---|
49| A2 | 110 Hz | −26.0 dB | −69.2 dB |
50| A3 | 220 Hz | −22.0 dB | −60.0 dB |
51| A4 | 440 Hz | −18.9 dB | −51.0 dB |
52| A5 | 880 Hz | −15.9 dB | −42.0 dB |
53| A6 | 1760 Hz | −12.7 dB | −32.0 dB |
54| E7 | 2637 Hz | −11.4 dB | −28.6 dB |
56Two regularities are visible. The folded energy of the bridge force rises by 3 dB per octave, because its partials fall like $1/n$ and the energy above the $K$th partial is then proportional to $1/K$, which doubles when the note rises an octave and $K$ halves. The pickup's rises by 9 dB per octave, because its partials fall like $1/n^2$ and the tail is proportional to $1/K^3$. Neither is small. Even at A2, sampling the bridge force directly puts a four-hundredth of the energy of the note into the wrong place, and at A6 a nineteenth.
58The one exception is A2 itself, where measurement and prediction differ by 1 dB. There $f_s/f_0 = 4410/11$ exactly, so the sampled signal repeats itself every 4410 samples and the folded partials land on a small set of frequencies, where they add with their phases rather than with their energies; the prediction assumes the latter. For a note whose frequency ratio to the sampling rate is not a ratio of small integers, which is the usual case in equal temperament, the prediction holds.
60### What this chapter establishes
62The exact solution of a problem in acoustics is not always the right thing to play. What should be played is the exact solution *band-limited* to the sampling rate, and for a string that is the modal sum stopped at the Nyquist frequency. Everything in the next two chapters is measured against that signal or against d'Alembert's solution at the same instants, and we will see in Chapter 2 that one numerical scheme reproduces d'Alembert's solution, aliasing included, to rounding error.
64Modal synthesis is also, in its own right, the best method in this tutorial for any problem whose modes are known: it is exact, its cost is one oscillator per partial, and it never disperses. The rest of the tutorial is about problems where the modes are not known, which in practice is almost all of them. We keep modal synthesis as the reference and use the string, the square and the disk as places where the other methods can be checked against it.