The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la...

16
AN ELECTRONIC JOURNAL OF THE SOCIETAT CATALANA DE MATEM ` ATIQUES * Xavier Gr` acia Universitat Polit` ecnica de Catalunya [email protected] Tom´ as Sanz-Perela Universitat Polit` ecnica de Catalunya [email protected] *Corresponding author Resum (CAT) Estudiem l’equaci´ o de les ones per a una corda amb rigidesa. Resolem l’equaci´ oi n’enunciem un teorema d’unicitat amb condicions de contorn adequades. Per a una corda punxada calculem l’espectre, que ´ es lleugerament inharm` onic. Per tant, l’habitual escala de 12 divisions iguals de l’octava justa no ´ es la millor elecci´ o per afinar instruments com ara el piano. Basant-nos en la teoria de la disson` ancia, proporcionem una manera d’afinar el piano a fi de millorar-ne la conson` ancia. Una bona soluci´ o s’obt´ e afinant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) We study the wave equation for a string with stiffness. We solve the equation and provide a uniqueness theorem with suitable boundary conditions. For a pinned string we compute the spectrum, which is slightly inharmonic. Therefore, the widespread scale of 12 equal divisions of the just octave is not the best choice to tune instru- ments like the piano. Basing on the theory of dissonance, we provide a way to tune the piano in order to improve its consonance. A good solution is obtained by tuning a note and its fifth by minimizing their beats. Keywords: wave equation, vibrating string, stiffness, inharmonic spectrum, musical scale, dissonance. MSC (2010): 00A65, 35G16, 35L05, 74K05. Received: February 4th, 2016. Accepted: June 23th, 2016. Acknowledgement X.G. acknowledges partial financial support by Generalitat de Catalunya project 2014– SGR–634. The authors wish to thank the anonymous referee whose comments have greatly improved the paper. 1 http://reportsascm.iec.cat Reports@SCM 3 (2017), 1–16; DOI: 10.2436/20.2002.02.11. The wave equation for stiff strings and piano tuning

Transcript of The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la...

Page 1: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

AN ELECTRONIC JOURNAL OF THE

SOCIETAT CATALANA DE MATEMATIQUES

∗Xavier Gracia

Universitat Politecnica deCatalunya

[email protected]

Tomas Sanz-Perela

Universitat Politecnica deCatalunya

[email protected]

∗Corresponding author

Resum (CAT)Estudiem l’equacio de les ones per a una corda amb rigidesa. Resolem l’equacio i

n’enunciem un teorema d’unicitat amb condicions de contorn adequades. Per a

una corda punxada calculem l’espectre, que es lleugerament inharmonic. Per tant,

l’habitual escala de 12 divisions iguals de l’octava justa no es la millor eleccio per

afinar instruments com ara el piano. Basant-nos en la teoria de la dissonancia,

proporcionem una manera d’afinar el piano a fi de millorar-ne la consonancia. Una

bona solucio s’obte afinant una nota i la seva quinta tot minimitzant els seus batecs.

Abstract (ENG)We study the wave equation for a string with stiffness. We solve the equation and

provide a uniqueness theorem with suitable boundary conditions. For a pinned string

we compute the spectrum, which is slightly inharmonic. Therefore, the widespread

scale of 12 equal divisions of the just octave is not the best choice to tune instru-

ments like the piano. Basing on the theory of dissonance, we provide a way to tune

the piano in order to improve its consonance. A good solution is obtained by tuning

a note and its fifth by minimizing their beats.

Keywords: wave equation, vibratingstring, stiffness, inharmonic spectrum,musical scale, dissonance.MSC (2010): 00A65, 35G16, 35L05,74K05.Received: February 4th, 2016.Accepted: June 23th, 2016.

AcknowledgementX.G. acknowledges partial financial support

by Generalitat de Catalunya project 2014–

SGR–634. The authors wish to thank the

anonymous referee whose comments have

greatly improved the paper.

1http://reportsascm.iec.cat Reports@SCM 3 (2017), 1–16; DOI: 10.2436/20.2002.02.11.

The wave equation for stiff strings andpiano tuning

Page 2: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Stiff strings and piano tuning

1. Introduction

The problem of finding appropriate scales for playing music has worried musical theorists and instrumentmakers for centuries. There is a close relationship between the theory of musical scales and the frequencyspectra of musical instruments; indeed, the harmonic spectrum of most instruments has lead to the presentday tempered scale, with 12 equal divisions of the octave (12-edo). However, piano strings have somedegree of stiffness, which implies that their spectrum is slightly inharmonic, and this explains why the tuningof the piano is actually “stretched”, with octaves slightly larger than should; see [6, p. 389]. The purposeof this paper is to perform an accurate mathematical study of the wave equation of a string with stiffness,and what does it imply to the choice of a scale. Throughout the paper we will assume an elementaryknowledge of acoustics (physical and perceptive properties of the sound) and of music theory (intervals andthe tempered scale); for the benefit of the reader, we have collected some of these notions in an appendix.

The classical wave equation, utt = c2uxx , models a perfectly elastic string. If we want to take thestiffness into account, we need to modify the equation. The simplest way to do this consists in adding aterm coming from the Euler–Bernoulli beam equation, which is used to model the deflection of rigid bars.The result is a fourth order PDE of the form utt = c2uxx − M2uxxxx that has been seldom studied inthe acoustics literature [6, 10], and often sketchily. This is why we have found it convenient to performa more detailed and self-contained study with rather elementary techniques; see Section 2. We computethe explicit form of the solutions, which turns out to be the same as in the non-stiff case, except by thefact that the frequency spectrum is no longer harmonic, but of the form fn = n f◦

√1 + Bn2, with n ≥ 1,

where B is a constant depending on the physical parameters of the string. We also show the existence anduniqueness for the PDE with appropriate boundary conditions.

For piano strings the value of the inharmonicity parameter B is about 10−3. This means that its spectralfrequencies slightly deviate from the harmonic ones (it has a “stretched harmonic spectrum”). Thoughsmall, this deviation is of great importance for the consonance of the intervals between notes, because thehuman ear is very sensitive to frequency differences.

The auditory perception qualifies some musical sounds as consonant (“pleasant”), whereas others aredissonant. As it is explained in more detail in Section 3 and in the Appendix, there is a close relationshipbetween dissonance, spectrum and scale: the choice of the notes used to play music aims to achieve thebest possible consonance, and this consonance depends directly on the spectrum of the sounds. Therefore,the fact that stiff strings have a slightly inharmonic spectrum leads to reconsider the exact tuning of thenotes we play with them. A tool to perform a systematic study of this problem is the dissonance curve of aspectrum. Basing on experimental results by Plomp and Levelt [11], one can define a function to measurethe dissonance of two notes as a function of their frequency ratio, and draw a dissonance curve, whichdepends strongly on the spectrum. The local minima of this curve indicate possible good choices for thenotes of the scale as far as the consonance of its intervals is concerned, [15].

We apply this approach to the string with stiffness. Its spectrum is given by fn = n f◦√

1 + Bn2 (seeSection 2) and therefore the ratio between the first and the second partials is not the just octave 2:1, buta “stretched octave” 2

√1 + 4B/

√1 + B. So, we wonder if there exist scales for this spectrum that could

possibly be more “consonant” than the usual 12-edo scale. Aiming to preserve the freedom to modulateto any tonality, we look for a scale with equal steps, or, equivalently, equal divisions of a certain interval,as for instance a stretched octave. In Section 4 we use the dissonance curve of the stretched spectrum tostudy this problem in two different ways. One is based in the coincidence of some partials. The other one

http://reportsascm.iec.cat2

Page 3: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Xavier Gracia, Tomas Sanz-Perela

minimizes a weighted mean of the dissonance. As a result, we obtain that a good solution is to tune thefifth by making the second partial of the higher note to coincide with the third partial of the fundamentalnote.

The paper is organised as follows. In Section 2 we study the modelling of a string with stiffness: we givean explicit solution of the equation when the boundary conditions are those of a pinned string, we presenta rigorous derivation of its spectrum, and we state a uniqueness theorem. In Section 3 we recall some factsabout the theory of dissonance and how to draw dissonance curves, and we obtain the dissonance curveof the string with stiffness. In Section 4 we study several proposals to tune the piano, either based in thecoincidence of partials or the minimization of the mean dissonance. Section 5 is devoted to conclusions.Finally, an appendix gathers some basic concepts of acoustics and music theory.

2. The wave equation for the string with stiffness

It is well known [14, 16] that the motion of a vibrating string (for instance, a violin string) can be representedby the solutions of the problem

∂2u

∂t2= c2∂

2u

∂x2x ∈ (0, L), t > 0

u(0, t) = u(L, t) = 0 t ≥ 0

u(x , 0) = φ(x) x ∈ [0, L]

∂tu(x , 0) = ψ(x) x ∈ [0, L],

where u(x , t) represents the transversal displacement of the string of length L (represented by the interval[0, L]) from its equilibrium position, and φ(x) and ψ(x) are, respectively, the initial shape and velocity ofthe string. The boundary conditions u(0, t) = u(L, t) = 0 for t ≥ 0 mean that the string has fixed endsand c2 = τ/ρ, with τ the tension of the string and ρ its linear density. The value c is the velocity of thetravelling waves along the string.

The solution of this equation can be computed using the method of separation of variables, obtaining

u(x , t) =∞∑n=1

[an cos (2πfnt) + bn sin (2πfnt)] sin(nπ

Lx)

, fn =nc

2L,

where the coefficients an and bn are obtained from the Fourier coefficients of the initial conditions φ, ψ.For the convergence and smoothness of this series some regularity conditions are required on φ, ψ; see, forinstance, [14].

The model of the wave equation is a good approximation for instruments like the guitar, whose stringsare almost perfectly flexible. However, when we want to model the motion of the piano strings, which havegreater stiffness, the classical wave equation is not good enough. For this reason, a term describing theresistance against bending is added to it (see [6, p. 64]), obtaining the following equation:

∂2u

∂t2= c2∂

2u

∂x2− ESK 2

ρ

∂4u

∂x4, (1)

where S is the cross-sectional area of the string, E is Young’s modulus of its material, ρ is its linear densityand K is the radius of gyration, which is K = R/2 for a cylindrical shape of radius R; see [6, p. 58].

3Reports@SCM 3 (2017), 1–16; DOI: 10.2436/20.2002.02.11.

Page 4: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Stiff strings and piano tuning

The added term is the same that appears in the beam equation (also called Euler–Bernoulli equation),modelling the motion of a vibrating beam under the hypotheses of no shear stress nor rotational inertia;a deduction of this equation can be found, for instance, in [6, p. 58], or at the end of [17, Chapter 2].One can view (1) as the generalization of a PDE for a vibrating material: the first term is due to theelasticity of the material (its capacity to return to the initial position after a deformation) and the secondone, due to the resistance against bending. If the first term is zero, the material is not elastic and we getthe beam equation. On the contrary, if the second term is zero, the material is not rigid and we get thewave equation.

The string with stiffness based on the Euler–Bernouilli model is the most widely used model. Never-theless, there exist other equations that can model the vibration of rigid materials (and in particular pianostrings). Prominent among them is the Timoshenko beam model, which takes into account shear stress androtational inertia [7]. The description of the motion of piano strings using this model has been thoroughlydiscussed recently in the thesis [3]. It is shown there that the frequencies of the string based upon theTimoshenko beam model behave as the ones based on the Euler–Bernouilli model for the lower partials;the Timoshenko model provides a better description for higher partials, a region where their contributionto dissonance is negligible. Therefore, the Euler–Bernouilli model is enough for our purposes.

2.1 Solving the equation

Equation (1) was studied in [5], where the author guesses the form of some solutions with separate variables.Besides that article, only a few references in the acoustics literature deal with the string with stiffness, andthey merely give approximate solutions of the spectrum, without further justification. A recent study of thisequation is in [3], where the exact formula for the frequency of the partials is found using Fourier transform,though the equation is not actually solved. So we have found it convenient to perform a detailed study:by following the standard method of separation of variables, we give a solution of the initial value problemwith appropriate boundary conditions, obtaining also the formula for the frequencies. Uniqueness of thesolution is studied in the following section.

We start by looking for a solution to equation (1) of the form u(x , t) = X (x)T (t). We have

XT ′′ = c2X ′′T − ESK 2

ρX (4)T =⇒ T ′′

T= c2 X ′′

X− ESK 2

ρ

X (4)

X. (2)

As the left-hand side of the equation depends only on t and the right-hand side, only on x , (2) has to bea non positive constant, called −ω2 (non positive because we are looking for periodic solutions in time):

T ′′

T= c2 X ′′

X− ESK 2

ρ

X (4)

X= −ω2.

If we look at the time equation, we have an ODE which is easy to solve: Tω(t) = A cosωt + B sinωt.

We look now for the solutions of the ODE for X :

ESK 2

ρX (4) − c2X ′′ − ω2X = 0 . (3)

We divide the equation by ESK 2/ρ and define a := c2ρ/ESK 2 and b := ρω2/ESK 2. After that, (3)becomes X (4) − aX ′′ − bX = 0 , whose solutions are of the form

C1 cosh k1x + C2 sinh k1x + C3 cos k2x + C4 sin k2x ,

http://reportsascm.iec.cat4

Page 5: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Xavier Gracia, Tomas Sanz-Perela

with k1 =√

(a +√

a2 + 4b)/2 and k2 =√

(−a +√

a2 + 4b)/2. We introduce again two convenientconstants:

B := π2ESK 2

τL2and f◦ :=

c

2L.

In this way, using the definition of a and b, we obtain the following relations between k1, k2 and ω:

k21 =

π2

2BL2

√1 +ω2B

f 2◦ π

2+ 1

and k22 =

π2

2BL2

√1 +ω2B

f 2◦ π

2− 1

. (4)

We want to find the possible values of k1 and k2, that will determine the possible values of ω. In orderto do it, we will impose the boundary conditions, but now, as the equation is of 4-th order, we need 4boundary conditions, two more apart from the Dirichlet boundary conditions on both ends of the string.We will consider two cases:

• X ′ = 0 at the ends; this case appears when the string is clamped at the ends.

• X ′′ = 0 at the ends; this happens when the string is pinned at the ends, since there is no moment.

The first case, X = X ′ = 0 at the ends of the string, leads to an equation that can be solved numerically,but it is not possible to get a closed formula for the spectrum of frequencies; see [5] for more details andfor an approximate formula. The second case, X = X ′′ = 0 at the ends of the string, is easier to solve andwill lead us to a formula for the frequencies of the partials. In the case of the piano, this second optionseems to be closer to reality, because the strings are supported on a bridge. From now on, we will focus inthis case.

Pinned boundary conditions. We are going to solve the problem with the condition X = X ′′ = 0 atthe ends of the string. Consider a general solution of (3), say

X (x) = C1 cosh k1x + C2 sinh k1x + C3 cos k2x + C4 sin k2x . (5)

We want to find the possible values of k1 and k2 that make (5) satisfy (non-trivially) the boundaryconditions. Let us impose these boundary conditions at the string ends, x = 0, L.

For x = 0, we obtain:

X (0) = C1 + C3 = 0 and X ′′(0) = C1k21 − C3k2

2 = 0 .

From the first equation we get −C3 = C1 and, replacing it in the second one, we arrive to the equationC1(k2

1 + k22 ) = 0, which implies C1 = C3 = 0.

Now we impose the boundary conditions at x = L to X (x) = C2 sinh k1x + C4 sin k2x , obtaining:

X (L) = C2 sinh k1L + C4 sin k2L = 0 and X ′′(L) = C2k21 sinh k1L− C4k2

2 sin k2L = 0.

Multiplying the first equation by k22 and adding it to the second one, we get C2(k2

1 + k22 ) sinh k1L = 0. As

the last two factors are different from zero, we conclude that C2 = 0.

Finally, we have C4 sin k2L = 0. As we want nontrivial solutions, we need C4 6= 0 and, thus, k2L = nπfor n ≥ 1. From this relation and (4) we obtain

(nπ

L

)2=

π2

2BL2

√1 +ω2nB

f 2◦ π

2− 1

5Reports@SCM 3 (2017), 1–16; DOI: 10.2436/20.2002.02.11.

Page 6: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Stiff strings and piano tuning

and, isolating ωn, we obtain the possible frequencies:

fn =ωn

2π= n f◦

√1 + Bn2 with n = 1, 2, ... (6)

Thus, for each of the ωn, the solution of (3) satisfying the boundary conditions is a multiple of

Xn(x) = sin(nπ

Lx)

with n = 1, 2, ...

Remarkably, these are the same modes of vibration as in the case without stiffness: the difference onlyshows up in the frequencies of vibration.

To conclude, we can write the general solution of the PDE (1), with boundary conditions u = 0 anduxx = 0 at the ends of the string, as:

u(x , t) =∞∑n=1

[an cos (2πfnt) + bn sin (2πfnt)

]sin(nπ

Lx)

, fn = n f◦√

1 + Bn2,

where an, bn are obtained from initial conditions in the same way as in the ideal case.

As we can see, the spectrum is no longer harmonic, but it is ‘stretched’ from the harmonic one due tothe factor

√1 + Bn2. For a cylindrical string of radius R the value of B is B = π3ER4/4τL2; its typical

values for a piano string are about 10−3.

Notice that the constant f◦ = c/2L would be the fundamental frequency of the string if it did not havestiffnes (B = 0); in this case, we would recover the frequency spectrum of the ideal string. When B > 0,the fundamental frequency is f1 = f◦

√1 + B, higher than f◦.

2.2 Uniqueness of solutions

We prove now a theorem of uniqueness of solutions for the wave equation with stiffness. This can beseen a particular case of the results of semigroup theory for evolution problems with monotone operators(see [2, 4]), but in this case we provide an elementary proof, similar to the uniqueness theorem for the waveequation, which can be found for instance in [14]. We will use the notation ∂nξ := ∂n/∂ξn when necessary.

Lemma 2.1. Let u(x , t) ∈ C4([0, L]× [0,∞)) satisfying

∂2u

∂t2= c2∂

2u

∂x2−M2∂

4u

∂x4, (7)

for x ∈ (0, L) and t > 0. In any of the two following cases{u(0, t) = u(L, t) = 0 t ≥ 0

∂xu(0, t) = ∂xu(L, t) = 0 t ≥ 0or

{u(0, t) = u(L, t) = 0 t ≥ 0

∂2xu(0, t) = ∂2xu(L, t) = 0 t ≥ 0,

the quantity

E(u) =1

2

∫ L

0

((∂tu)2 + c2(∂xu)2 + M2(∂2xu)2

)dx

is constant in time.

http://reportsascm.iec.cat6

Page 7: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Xavier Gracia, Tomas Sanz-Perela

Proof. We just need to show that the derivative with respect to t of E(u) is zero:

d

dt(E(u)) =

∫ L

0

(∂tu ∂

2t u + c2∂xu ∂t∂xu + M2∂2xu ∂t∂

2xu

)dx (using (7))

=

∫ L

0

(∂tu(c2∂2xu −M2∂4xu) + c2∂xu ∂t∂xu + M2∂2xu ∂t∂

2xu

)dx

= c2

∫ L

0

(∂tu ∂

2xu + ∂xu ∂x∂tu

)dx + M2

∫ L

0

(∂2xu ∂2x∂tu − ∂tu ∂4xu

)dx =: c2Ic + M2IS .

Now,

Ic =

∫ L

0

(∂tu ∂

2xu + ∂xu ∂x∂tu

)dx

parts=

∫ L

0

(∂tu ∂

2xu − ∂2xu ∂tu

)dx +

[∂xu ∂tu

]L0

=[∂xu ∂tu

]L0

,

which is zero due to the Dirichlet boundary condition (u = 0 at 0, L for all t ≥ 0 implies ∂tu = 0 for allt ≥ 0). Similarly, we have

IS =

∫ L

0

(∂2xu ∂2x∂tu − ∂tu ∂4xu

)dx

parts=

∫ L

0

(− ∂3xu ∂x∂tu − ∂tu ∂4xu

)dx +

[∂2xu ∂x∂tu

]L0

parts=

∫ L

0

(∂4xu ∂tu − ∂tu ∂4xu

)dx +

[∂2xu ∂x∂tu

]L0−[∂3xu ∂tu

]L0

=[∂2xu ∂x∂tu

]L0−[∂3xu ∂tu

]L0

,

which is again zero due to the boundary conditions.

Therefore, we get d(E(u))/dt = 0.

Thanks to this result, we can now prove the next theorem. Indeed, in its formulation we include asource term and nonhomogeneous boundary conditions, so it is slightly more general than the problem ofthe stiff string we are studying.

Theorem 2.2. There exists at most one solution u ∈ C4([0, L]× [0,∞)) of the problem

∂2u

∂t2= c2∂

2u

∂x2−M2∂

4u

∂x4+ f (x , t) x ∈ (0, L), t > 0

u(0, t) = u(L, t) = δ(t) t ≥ 0

∂2xu(0, t) = ∂2xu(L, t) = µ(t) t ≥ 0

u(x , 0) = φ(x) x ∈ [0, L]

∂tu(x , 0) = ψ(x) x ∈ [0, L] .

(8)

This is also true if, instead of conditions on ∂2xu, we put conditions on ∂xu: ∂xu(0, t) = ∂xu(L, t) = η(t).

Proof. Let u1 and u2 be two solutions of the problem (8). Since the PDE is linear, u := u1− u2 solves thehomogeneous problem

∂2u

∂t2= c2∂

2u

∂x2−M2∂

4u

∂x4x ∈ (0, L), t > 0

u(0, t) = u(L, t) = 0 t ≥ 0

∂2xu(0, t) = ∂2xu(L, t) = 0 t ≥ 0

u(x , 0) = 0 x ∈ [0, L]

∂tu(x , 0) = 0 x ∈ [0, L] .

(9)

7Reports@SCM 3 (2017), 1–16; DOI: 10.2436/20.2002.02.11.

Page 8: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Stiff strings and piano tuning

By lemma 2.1, the non negative quantity E(u) is constant in t. But at time t = 0,

E(u)∣∣t=0

=1

2

∫ L

0

((∂tu)2 + c2(∂xu)2 + M2(∂2xu)2

)∣∣∣∣t=0

dx = 0

so, E(u) ≡ 0 for all time. Therefore,

(∂tu)2 + c2(∂xu)2 + M2(∂2xu)2 = 0 =⇒ ∂tu = 0 , ∂xu = 0 (and ∂2xu = 0) .

Since all partial derivatives of first order of u are zero, u is a constant function. Finally, at t = 0, u = 0,so u ≡ 0 for all time t ≥ 0. Therefore, u1 = u2.

The proof for boundary conditions on ∂xu is completely analogous.

3. Scales, spectrum and dissonance curves

As we mentioned in the introduction, if a spectrum is given, by analysing its dissonance curve, one can tryto find appropriate scales for it. In this section we provide some details for this analysis, following [15].

In 1965, Plomp–Levelt [11] performed an experiment aiming to measure the dissonance of two puretones in terms of their distance; this dissonance was evaluated by many subjects, and as a result theyconcluded that the maximal degree of dissonance is attained at roughly 1/4 of the critical bandwidth, aconcept from psychoacoustics that had been introduced and studied some years before (see also [12]).Except for low frequencies, the width of a critical band corresponds to an interval around a minor third.

Plomp and Levelt claimed that this could be extrapolated to complex tones, so that the dissonance ofa sound could be computed as the sum of the dissonances of all the pairs of its partials. More specifically,by taking a harmonic spectrum with 6 partials (and equal loudnesses), they obtained a dissonance curvesimilar to Helmholtz’s, showing points of local minimal dissonance for frequency ratios α equal to 1:1, 2:1,3:2, 5:3, 4:3, 6:5, 5:4, and a maximum of dissonance near the semitone interval. Figure 1 shows some ofPlomp and Levelt’s results.

More recently, Sethares [15] did a systematic study of the dissonance curve of several spectra, andshowed the close relationship between spectrum and scales; his work includes the synthesis of artificialspectra adapted to play music in exotic scales, while still retaining some degree of consonance.

We want to apply this procedure to the spectrum of the string with stiffness. For this, we needa specific expression of a function modelling the dissonance. Following [15], given two pure tones offrequencies f1 ≤ f2 (expressed in Hz) and loudnesses `1, `2 then the dissonance (in an arbitrary scale)can be expressed as d(f1, f2, `1, `2) = min(`1, `2)

(e−b1 s (f2−f1) − e−b2 s (f2−f1)

), where s = x∗/(s1f1 + s2),

and the parameters are b1 = 3.5, b2 = 5.7, x∗ = 0.24, s1 = 0.021 and s2 = 19. The graph of thisfunction reproduces the shape obtained by Plomp and Levelt, Figure 1 (left); dissonance is measured in anarbitrary scale, therefore usually we will normalize its expression so that it takes values between 0 and 1.The preceding expressions and numbers give just a possible model for the dissonance of two tones; othermodels (see for instance [1]) can be used and, qualitatively, the results are the same.

Then, if F is a spectrum with frequencies f1 < · · · < fn and loudnesses `1, ... , `n, the dissonance of Fis defined as the sum of the dissonances of all the pairs of partials, dF =

∑i<j d(fi , fj , `i , `j). Finally, the

dissonance function of a given spectrum F is the function that yields the dissonance of two tones as a

http://reportsascm.iec.cat8

Page 9: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Xavier Gracia, Tomas Sanz-Perela

Figure 1: Graphics of Plomp and Levelt’s results [11]. Left: Dissonance of two pure tones as a function oftheir distance measured in critical bandwidths; extrapolated from experimental data. Right: Theoreticalmodel of the dissonance of two harmonic tones as a function of their frequency ratio (the vertical linesmark the steps of the 12-edo scale).

function of the ratio α of their fundamental frequencies: DF (α) = dF∪αF , where we denote by αF thespectrum F with its frequencies scaled by the factor α, and by F ∪ αF the union of both spectra.

The graph of the function DF is the dissonance curve of the given spectrum, and its analysis can help usto find an appropriate scale (and conversely: given an arbitrary scale, is there an appropriate spectrum forit?). Nevertheless, this is not so immediate, and these results do not tell us how to construct a scale. Forinstance, consider the harmonic spectrum and its dissonance curve as in Figure 1 (right). From a referencenote —a C, say— one can form a just scale by adding other notes coinciding with the local minima ofthe dissonance curve: G (3:2), F (4:3), A (5:3), E (5:4), etc. Notice, however, that from each of thesenew notes we should consider again the dissonance curve in relation with the notes already chosen. Thisanalysis is simpler when we use an equal-step scale, like 12-edo, because the relative positions of the notesare the same. In the same figure we see the abscissas of the 12-edo scale; it is clear that local minima ofdissonance are attained near points that are at a distance of 3, 4, 5, 7, 9 and 12 steps from any given note.

Now let us apply this procedure to the piano. As we have already noted in the preceding sections,its strings have a certain degree of stiffness, and, according to (6), their spectrum is given by fn =n f◦√

1 + Bn2, for n ≥ 1. We can draw its dissonance curve and we observe that, for small B > 0, thelocal minima of dissonance are slightly shifted to the right with respect to those of the harmonic spectrum;see Figure 2.

Notice, in particular, that the octave and the fifth (the most important intervals of Western music)of the usual 12-edo scale are noticiably flatter than the “optimal” octave and fifth deduced from thestretched spectrum, i.e., the corresponding intervals where this spectrum has a local minimum of dissonance.Therefore the 12-edo scale seems not to be the best choice to play music as far as dissonance is concerned.This fact makes us wonder which is the “best” tuning for the piano, i.e., a tuning that fits better with theminima of the dissonance curve. We give an answer to this question in the next section.

9Reports@SCM 3 (2017), 1–16; DOI: 10.2436/20.2002.02.11.

Page 10: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Stiff strings and piano tuning

Figure 2: Comparison betwwen the dissonance curves of the harmonic spectrum (dashed) and the stretchedspectrum (solid) of a string with stiffness. The grey vertical lines show the steps of the usual 12-edo scale;the black ones show the just fifth and octave. (We have used B = 0.0013 for the sake of clarity.)

4. Proposals for the piano tuning

We have just seen that, due to the stiffness of the strings, the spectrum of the piano is slightly stretched,and therefore the minima of the dissonance curve do not coincide with the notes of the usual 12-edo scale,not to say other tunings like just intonation. Now our goal is to find a scale that preserves, as much aspossible, the consonance of the main intervals of music. We will restrict our search to scales with equalsteps, because we want to preserve the freedom to modulate to arbitrary tonalities —this is especiallyimportant for piano music. So, if r is the frequency ratio of the step of the scale, and f is the frequencyof its fundamental note, the frequencies of all the notes are f , r f , r2f , r3f , ...

We will follow two procedures. The first one is based on the coincidence of a couple of partials: thentheir beats disappear and we avoid their dissonance, as it is explained in the Appendix. We will explorethree possible choices for the step and see what do they imply for the dissonance curve. The second oneis to define an average dissonance as a function of the step and try to minimize it.

It should be remarked that in this study we assume that the stiffness parameter B is the same for allthe strings. This is approximately true in the middle third of the keyboard [5]. For the lower third of thekeyboard, the stiffness parameter of the strings is very low, indeed they are manufactured in a special way,so that a different analysis would be required; besides this, the overall dissonance in this region is high.For the upper third of the keyboard, the upper partials are weak (and even become rapidly inaudible), sothat their effect on the dissonance can be neglected.

In all calculations we will use the obtained formula for the partials, fn = n f◦√

1+Bn2 (n ≥ 1), as wellas the expresions of the dissonance functions defined in Section 3. We will consider B ∈ [0.0004, 0.002],see [5], but we will also see that we recover the results for the harmonic case when B → 0.

4.1 Coincidence of partials

Here, our strategy to construct a scale close to 12-edo is as follows:

(i) We consider a fixed note of fundamental frequency f1. Suppose we have already fixed a second note,

http://reportsascm.iec.cat10

Page 11: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Xavier Gracia, Tomas Sanz-Perela

f1 = f◦√

1 + B f2 = 2f◦√

1 + 4B f3 = 3f◦√

1 + 9B f4 = 4f◦√

1 + 16B

12edo f1 = 2f1 f2 = 4f◦√

1 + 4B

A2,1f1 = f2 f2 = 4f◦(1 + 4B)/

√1 + B

A3,1f1 = f3

A3,2f1 f2 = f3

Figure 3: The partials of the stretched spectrum are represented in the upper line; they are compared withthe harmonic ones (black nodes). In the lower lines the partials of four tunings are shown: the usual justoctave (12-edo), the octave of A2,1, the twelfth of A3,1, and the fifth of A3,2.

of fundamental frequency f 1. Then we divide the interval f 1 : f1 in p equal parts, thus obtaining astep whose frequency ratio is r = (f 1/f1)1/p. We will choose the number of parts p that makes thestep r to be the closest possible to the frequency ratio of the 12-edo semitone, 21/12.

(ii) So we have to properly choose the second note f 1. We base this choice upon the spectrum of thenotes, (fi )i≥1 and (f i )i≥1. In our particular case, we seek the coincidence of some partials. So, wedefine the tuning Am,n as the one obtained by letting the m-th partial fm of the first note to coincidewith the n-th partial f n of the second note. Equating fm = f n determines f n and therefore f 1.

(iii) Finally, if r = rm,n is the step of Am,n, the notes of the scale are rk f1, for integer values of k.

We have noticed before that the coincidence of some partials does not necessarily imply consonance.However, this analysis is meaningful because it can be directly applied to actual tuning, since it is easy totune an interval by letting beats disappear; moreover, we will see later that one of our proposals will beespecially good in terms of dissonance.

As the octave and the fifth are the most important intervals in music, three natural tunings can beconsidered:

(i) A2,1: the second partial f2 of the first note coincides with the first partial f 1 of the second note (wetry to minimize the beats of the octave).

(ii) A3,1: the third partial f3 of the first note coincides with the first partial f 1 of the second note (wetry to minimize the beats of the twelfth).

(iii) A3,2: the third partial f3 of the first note coincides with the second partial f 2 of the second note (wetry to minimize the beats of the fifth).

In Figure 3 we show a schematic description of these tunings. Once we have tuned our interval f 1 : f1,we divide it in p equal parts: 12 for the octave, 19 for the twelfth, and 7 for the fifth. These steps are thesemitones of the corresponding tuning. Their frequency ratio is given by (f1/f1)1/p; in our cases, they are:

r2,1 = 21/12(

1 + 4B

1 + B

)1/24

, r3,1 = 31/19(

1 + 9B

1 + B

)1/38

, and r3,2 =

(3

2

)1/7(1 + 9B

1 + 4B

)1/14

.

11Reports@SCM 3 (2017), 1–16; DOI: 10.2436/20.2002.02.11.

Page 12: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Stiff strings and piano tuning

Figure 4: Left: The dissonance curve of the stretched spectrum (B = 0.001) near the just octave; verticallines show the octave generated by different steps r : from left to right, r = 21/12 (12-edo), r = r2,1,r = r3,1, and r = r3,2. Right: The same near the just fifth.

Now, a given choice of the step r defines a scale, and we can locate its notes in the dissonance curve.The idea is that, by stretching the gap between the notes (vertical lines in Figure 2), possibly the newnotes will fit better the minima of the dissonance curve of the stretched spectrum (solid line in the figure).

One of our main goals is to tune the octave, the most important interval in music. Therefore, weanalyze in particular how the new octaves generated by these steps (the ratio obtained by r12, for each ofthe chosen values of r) fit the minimum of the dissonance curve near the frequency ratio 2. The same canbe done with the fifth by analyzing the ratios r7 near the ratio 3:2 in the dissonance curve. The results areshown in Figure 4.

From that figure it appears that the tuning A3,2 fits better than the others the minimum of dissonanceat the octave and also at the fifth. For the octave this may seem paradoxical because A2,1 was set to tunethe octave ad hoc, but actually this tuning only makes the dissonance caused by a single pair of partialsto disappear, whereas other partials may give rise to higher dissonance. This suggests also that our studyshould consider all the other intervals, because we are not controlling their dissonance. In the next sectionwe make a proposal to deal with this.

4.2 Minimization of dissonance

The preceding analysis can be completed by performing a general study of the dissonance of all the intervalsof the scale. We would like to find the semitone r which minimizes (in some sense) the total dissonanceof the scale.

In the most general setting, we could define the mean dissonance of a scale as a weighted sum of thedissonances of all couples of notes. The weighting is necessary because not all intervals are equally usedin music, and different intervals have different musical roles; therefore their consonances are not equallyimportant.

For an equal step scale it is enough to consider the dissonances of all the notes with respect to a givenone, that is, the dissonances between the fundamental note of the scale (with frequency f1) and the others(with frequencies rk f1). More specifically, given a semitone r , we define the mean dissonance of the equalstep scale generated by r as a weighted average of the dissonances of all the intervals from the fundamentalnote of the scale within the range of an octave, that is:

Dm(r) :=12∑k=1

wk DF (rk),

http://reportsascm.iec.cat12

Page 13: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Xavier Gracia, Tomas Sanz-Perela

Figure 5: Left: Plot of Dm(r) for different values of B ∈ [0, 0.002]. For each B the marked pointcorresponds to the minimum r∗. The vertical line represents the 12-edo semitone. Right: Distance to the12-edo semitone of the three tunings and the optimal semitone (in cents).

where F is the spectrum of the fundamental note f1, including frequencies and loudnesses, and w = (wk)is a vector of weights. In the following calculations we have used w = (1, 1, 4, 4, 5, 2, 6, 4, 4, 2, 1, 10) togive preeminence to the octave, the fifth, etc. Intervals larger than an octave could be considered in thesum; we omit them because their effect on the dissonance is small and we have to cut the sum at somepoint.

If we minimize the function Dm(r), numerically, on the interval r ∈ [1.0585, 1.061], near the 12-edosemitone 21/12, we find different values for the minimum point r∗ depending on B. The results are shownin Figure 5 (left).

We want to compare this optimal semitone with the semitones of the three tuning proposals consideredbefore. For each B, we compute the distance of these four semitones to the 12-edo semitone; this is shownin Figure 5 (right). As we can see, the semitone of A3,2 approximates the optimal semitone: (i) betterthan the 12-edo semitone if B is higher than 0.00025; (ii) better than the other proposals if B is higherthan 0.0005; and (iii) coincides with the optimal semitone if B is higher than 0.001. Notice also that theoptimal semitone coincides with the 12-edo semitone when B = 0.

The graphics in Figure 5 have been computed with Matlab. We have used a spectrum of 6 partials,the value f◦ = 440 Hz, the weighting vector as defined before, and the loudnesses inversely proportional tothe number of the partial. Nevertheless, we have also checked that the results obtained are quite similar ifwe use the same loudness for all partials, the same weights for all intervals, or 7 partials instead of 6.

5. Conclusions

We have studied the spectrum of strings with stiffness modelled according to the Euler–Bernouilli model.Although this was already known, we have done a mathematically rigorous derivation of it using elementarytechniques. We have applied this result and the theory of dissonance to study the tuning of the piano witha scale of equal steps. We have followed two approaches: one is to define a scale based on the coincidenceof some specific partials; the other one is to define an average dissonance of a scale and trying to minimizeit as a function of the step. It appears that a good solution is to tune a note and its fifth by forcing their3rd and 2nd partials, respectively, to coincide.

13Reports@SCM 3 (2017), 1–16; DOI: 10.2436/20.2002.02.11.

Page 14: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Stiff strings and piano tuning

Appendix: sound and music

In this appendix we summarize some basic information about sound and music. This can be found in manybooks, as for instance [1, 13].

Sound, pitch, spectrum. Sound is both an oscillation of the air pressure, and also the auditory sensationit creates. Besides duration, sound has three main perceptive attributes: loudness, pitch and timbre. Theseare related to physical attributes: amplitude, frequency and spectrum. However, these relations are by nomeans simple.

Let us consider the pitch, a quality that allows sounds to be ordered from lower to higher pitches. Apure tone of frequency ν and amplitude A is described by a sinusoid A sin(2πνt), and its pitch can beidentified with the frequency. A musical sound is usually a superposition of pure tones (the partials) ofseveral frequencies and amplitudes; these constitute the spectrum of the sound. For instance, most windand string instruments have harmonic spectrum, i.e., their spectral frequencies are integer multiples ofa fundamental frequency f1, that is, fn = n f1, with n ≥ 1. Such a sound is perceived to have a pitchidentified with frequency f1. However, not every sound can be attributed a pitch; some musical instruments,for instance most drums, have indefinite pitch.

Intervals, octave, semitone, cents. The difference between two pitches is called interval. The pitchperception obeys two fundamental rules. One is the logarithmic correspondence: the interval from twopitches of frequencies ν1, ν2 only depends on their frequency ratio ν2 : ν1. The other one is the octaveequivalence: two pitches an octave apart (ratio 2:1) are musically equivalent.

One can measure intervals in the multiplicative scale by their frequency ratio, or in the additive scaleby their size expressed in octaves, for instance. A frequency ratio of r corresponds to log2 r octaves. Otherimportant intervals are the semitone, which is 1/12 of an octave (therefore its ratio is 21/12), and the cent,which is 1/100 of a semitone.

The human ear is exceedingly sensitive to pitch perception. The difference limen (or just noticeabledifference) between two tones can be, depending on the frequency and intensity, as small as 10 cents.It can be much smaller if both sounds are played together. Therefore it is of the greater importance tocorrectly tune a musical instrument.

Notes, scales, 12-edo. In some instruments (e.g. the violin) the player can play virtually any pitch withinits playing range. This is not true for other instruments (e.g. the piano, or most wind instruments), whereonly a finite set of pitches is directly playable. A selection of pitches to play music is called a scale, and itselements are the notes of the scale. The construction of these scales is one of the fundamental problemsin music theory. Notice that if we have chosen a scale on a theoretical basis, then we have to adjust or totune the pitches of the notes of the instrument to the pitches of the scale; therefore one frequently saystuning system to mean a scale.

From ancient times it is known that two similar strings sounding together are more pleasant when theirfundamental frequencies are in a ratio of small integers. These intervals are called just, and, in addition tothe octave, the most important ones are the fifth (ratio 3:2), the fourth (4:3) and the major and minor thirds(5:4 and 6:5). (These names have a historic origin, of course.) So one would look for scales whose notesdefine such intervals. But, of course, other intervals will appear, and maybe they will be not so pleasant.Moreover, the evolution of the musical language during the last centuries has added more requirements tothe scales, and as a result the problem of defining a scale does not have a universal optimal solution. What

http://reportsascm.iec.cat14

Page 15: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Xavier Gracia, Tomas Sanz-Perela

is more, from antiquity to modern times, dozens of scales have been proposed and put into practice, [9].

Among all of these scales, there is one that is pervasive in Western music since 19-th century. It is theso-called equal temperament, and consists of 12 equal divisions of the octave (12-edo). The explanationfor this choice is that the 12-edo scale yields an excellent approximation of the just fifth (27/12 ≈ 3 : 2) andthe just fourth, but also acceptable approximations of the just thirds.

It is worth noting that, for instance, the same name “fifth” is applied to two intervals that are indeeddifferent: the just fifth and the 12-edo fifth. This is usual: the traditional name of an interval applies toall the intervals that have the same musical function regardless of their exact tuning. The same happenswith the notes: A4 has nowadays a “standard pitch” of 440 Hz, but it is usual to tune this note to 442 Hz,for instance. In past times its values were much more diverse.

Due to the logarithmic correspondence, from the viewpoint of music theory, to define a scale one canfix the pitch ν0 of a fundamental note with some degree of arbitrariness; what is really important are theintervals rk = νk : ν0 between this note and the other ones, νk . From these intervals, and the fundamentalnote, the other notes can be reconstructed as νk = rk ν0. Alternatively, one can define a scale by givingthe steps between consecutive notes, νk : νk−1; for instance, the 12-edo scale has equal steps of ratio 21/12.

Beats, dissonance, consonance. Using trigonometric identities it is easily proved that the superpositionof two pure tones A sin(2πν1t) and A sin(2πν2t) can be expressed as 2 A cos

(2π ν1−ν22 t

)sin(2π ν1+ν22 t

). If

the frequency difference ν1−ν2 is small (about less than 10–15 Hz), this is perceived as a sound of frequencyν = ν1+ν2

2 with slowly fluctuating amplitude; these are the beats. If the frequency difference is somewhatbigger, one perceives some roughness. When the difference is even higher, then one perceives two separatetones [12, pp. 37–40]. This roughness gives rise to the notion of sensory dissonance; this is the only notionof dissonance we are concerned about, though there are others (see, for example, [11] and [15, Ch. 5]).

Now, consider two (or more) complex tones sounding together: they have many partials that maybe close in frequencies. In the middle of the 19-th century, H. Helmholtz described the dissonance as theroughness produced by close partials, and the consonance as the exceptional condition where this roughnessalmost disappears. By computing the beats of the partials of two harmonic tones, Helmholtz showed thatthe aforementioned just intervals (octave, fifth, fourth, thirds) are more consonant than others [8, p. 193],in good agreement with music theory. This result can be easily understood: just notice that, if thefundamental frequencies f , f of two harmonic tones are in a ratio of small integers f : f = ` : k , then the`-th partial of the first tone will coincide with the k-th partial of the second one; a slight change of f wouldlead to close but different partials, and therefore to some roughness.

References

[1] D.J. Benson, “Music, a mathematical offering”,Cambridge University Press, 2008.

[2] H. Brezis, “Functional analysis, sobolev spacesand partial differential equations”, Springer,2011.

[3] J. Chabassier, “Modelisation et simulation

numerique d’un piano par modeles physiques”,Ph.D. thesis, Ecole Polytechnique ParisTech,2012.

[4] L.C. Evans, “Partial differential equations”,AMS Press, 1998.

[5] H. Fletcher, “Normal vibration frequencies of

15Reports@SCM 3 (2017), 1–16; DOI: 10.2436/20.2002.02.11.

Page 16: The wave equation for sti strings and piano tuning · bona soluci o s’obt e a nant una nota i la seva quinta tot minimitzant els seus batecs. Abstract (ENG) ... spectra of musical

Stiff strings and piano tuning

a stiff piano string”, J. Acoust. Soc. Am. 36(1964), 203–209.

[6] N.H. Fletcher and T.D. Rossing, “The physicsof musical instruments” (2nd ed), Springer,1998.

[7] S.M. Han, H. Benaroya, and T. Wei,. “Dy-namics of transversely vibrating beams usingfour engineering theories”, J. Sound Vibr. 225(1999), 935–988.

[8] H. Helmholtz, “On the sensations of tone” (3rded), Longmans (original in German, 1877, 4thed), 1895.

[9] M. Lindley, “Temperaments”, Grove Music On-line, 2015.

[10] P.M. Morse and K.U. Ingard, “Theoreticalacoustics”, McGraw-Hill, 1968.

[11] R. Plomp and W.J.M. Levelt, “Tonal conso-nance and critical bandwidth”, J. Acoust. Soc.Am. 38 (1965), 548–560.

[12] J.G. Roederer, “The physics and psychophysicsof music”, Springer, 2008.

[13] T.D. Rossing, F.R. Moore, and P.A. Wheeler,“The science of sound” (3rd ed), Addison-Wesley, 2002.

[14] S. Salsa, “Partial differential equations in ac-tion. From modelling to theory”, Springer,2008.

[15] W.A. Sethares, “Tuning, timbre, spectrum,scale” (2nd ed), Springer, 2005.

[16] W.A. Strauss, “Partial differential equations.An introduction”, Wiley, 2008.

[17] A.N. Tikhonov and A.A. Samarskii, “Equationsof mathematical physics”. Pergamon, 1963.

http://reportsascm.iec.cat16