Consonance in Music and Mathematics

Consonance in Music and Mathematics:
Application to Temperaments and Orchestration
Constança Martins de Castro Simas
Thesis to obtain the Master of Science Degree in
Mathematics and Applications
Supervisor: Henrique Manuel dos Santos Silveira de Oliveira
Examination Committee
Chairperson:
António Manuel Pacheco Pires
Supervisor:
Henrique Manuel dos Santos Silveira de Oliveira
Member of the Committee:
João Maria da Cruz Teixeira Pinto
December, 2014
ii
Acknowledgments
I’m very glad that the process of writing this thesis led me to learn and share interesting opinions with
people from different backgrounds.
I want to thank my advisor for accepting and encouraging my eccentric ideas. Gladly, the brainstorming reunions contributed to this final result in the best way possible. My colleagues Ricardo Vieira
Lisboa and João Carvalho were also a great help throughout this process. They gave their input while
solving some mathematical problems, and sometimes just kept me company while i complained about
what were the work’s issues at the moment.
Carrying on to a little different background i want to thank all the musicians that helped me. Some
of them by agreeing on spending their time and talent recording material and others just because of the
interest they showed in helping me understand how their musical instruments worked. Namely Henrique Costa, Thierry Redondo, João Ferreira, Catarina Dinis, Rafaela Oliveira, Diana Santos, Natacha
Fernandes, Joana Mendes, Ana Conceição, Sérgio Sousa, Aldara Medeiros e Sílvia Rocha. I want to
thank specially Tiago Ramos and Rita Blanco who were always there to support me, also in the whole
logistics required to record with a dozen instrumentalists in one afternoon. Great thanks also to my
music analysis teacher, Pedro Figueiredo, who kept giving me some ideas to work with.
Lastly, i want to thank my whole family. My cousin Tiago Simas Freire for supporting me in some
musicology issues, but most of all my parents who also suffered when some things didn’t seem to be
solvable, and helped me in everything they could to make me succeed.
iii
iv
Resumo
A música e a matemática são duas áreas que, ao longo do tempo, têm vindo a perder as suas ligações.
Nesta tese são feitas várias abordagens à relação entre as mesmas. Uma delas mais relacionada com
as afinações de escalas usadas na antiguidade, e outra com a acústica e consonância numa orquestra
actual.
Pitágoras estudou a relação entre os números racionais e os sons puros, procedendo depois à
afinação de escalas de forma a preservá-los. Como consequência, obteve uma escala que não era
uniforme em termos de consonância. Hoje em dia, os músicos convivem com uma afinação que, apesar
de ser prática e extremamente uniforme, não dá valor aos sons puros. Neste estudo, serão procuradas
as afinações capazes de optimizar ambos os aspectos. Para tal, criar-se-á um método computacional
capaz de devolver a consonância de duas notas, num intervalo de zero a um.
A segunda vertente explorada ao longo da tese, é relacionada com a orquestra e os diferentes sons
que a constituem. As "cores" dos instrumentos na orquestra são diferenciadas de forma matemática.
Um som produzido por um instrumento tem um espectro harmónico que lhe corresponde, definindo o
seu timbre. Para obter estes espectros, serão utilizados conceitos da teoria de Fourier, mais especificamente a Transformada de Fourier Discreta. Este processo parte da gravação dos instrumentos,
passando pela análise das respectivas ondas sonoras na linguagem Mathematica.
Palavras-chave: consonância, espectro harmónico, transformada de Fourier
v
vi
Abstract
Music and Mathematics are two fields that lost their link over time. In this thesis, we make two different
approaches to the relation between them. One of the approaches relates with the tuning of scales
performed in ancient times, and the other with acoustics and consonance in orchestra nowadays.
Pythagoras studied the relation between rational numbers and pure sounds, tuning scales in a way
that would preserve this perfect consonances. However, this turned out to have an irregular consonance
in the different intervals of the scale. Nowadays, musicians deal with a tuning system that, despite being
extremely practical and uniform, doesn’t value much the pure intervals. Our goal is to find a tuning system capable of optimizing the features mentioned above. Therefore, we shall develop a computational
method which outputs the consonance between two musical notes, in a range from zero to one.
The second matter developed along this thesis is about the orchestra and the different sounds in it.
The “colors” of the instruments in the orchestra are distinguished through a mathematical procedure. A
sound produced by an instrument is defined by its harmonic spectrum, representing its timbre. To derive
these spectra, we shall use concepts from Fourier theory, specially the Discrete Fourier Transform. This
process is initiated with the recording of instrument sounds in an anechoic chamber, and then completed
with the analysis of the soundwaves using the Mathematica language.
Keywords: consonance, harmonic spectrum, Fourier transform
vii
viii
Contents
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iii
Resumo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
v
Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vii
List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xi
List of Figures
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
1 Introduction
1
1.1 Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 State-of-the-art
2
3
2.1 What is sound? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
2.2 What is consonance? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
2.3 Soundwaves and Fourier Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
2.3.1 Wave equation and the Beats phenomenon . . . . . . . . . . . . . . . . . . . . . .
8
2.3.2 Fourier Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
2.3.3 Fourier Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
3 Computing consonance
12
3.1 Recording orchestral instruments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
3.2 Calculation of the frequency spectra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
3.3 A program to compute consonance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
3.3.1 1st step: Grouping frequencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
3.3.2 2nd step: Notion of timbre in the program . . . . . . . . . . . . . . . . . . . . . . .
17
3.3.3 3rd step: Critical Bandwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
4 Temperaments
22
4.1 Pythagorean Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
4.2 Just Intonation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
4.3 Meantone Temperaments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
4.4 Equal Temperament . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
4.5 Consonance calculations and results for each Temperament . . . . . . . . . . . . . . . . .
30
ix
5 Timbres and Consonance in the Orchestra
33
5.1 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.1.1 Violin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
5.1.2 Viola . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
5.1.3 Cello . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
5.2 Woodwinds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
5.2.1 Flute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
5.2.2 Oboe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
5.2.3 Clarinet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
46
5.2.4 Bassoon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
47
5.3 Brass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
49
5.3.1 Trumpet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
5.3.2 French Horn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52
5.3.3 Trombone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53
5.3.4 Tuba . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
54
5.4 Percussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.5 Consonance analysis of orchestral excerpts . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.5.1 Weight function of a harmonic spectrum . . . . . . . . . . . . . . . . . . . . . . . .
60
5.5.2 Wagner’s Tristan chord
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
5.5.3 Beethoven’s fifths in the 9th symphony . . . . . . . . . . . . . . . . . . . . . . . . .
64
5.5.4 Clarinet and oboe, the most consonant dissonance . . . . . . . . . . . . . . . . . .
65
6 Conclusions
66
6.1 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
67
Bibliography
70
7 Appendix
71
x
List of Tables
2.1 Ratios of the most important intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
4.1 Ratios of the intervals in a Pythagorean chromatic scale . . . . . . . . . . . . . . . . . . .
25
4.2 Ratios of the intervals in a Just chromatic scale . . . . . . . . . . . . . . . . . . . . . . . .
26
4.3 Ratios of the intervals in an Equal chromatic scale . . . . . . . . . . . . . . . . . . . . . .
29
4.4 Consonance in all the temperaments with weight g(x) . . . . . . . . . . . . . . . . . . . .
31
4.5 Consonance in all the temperaments with weight from Figure 4.9 . . . . . . . . . . . . . .
32
5.1 Values of zeros for Bessel functions [Benson, 2007]. . . . . . . . . . . . . . . . . . . . . .
58
5.2 Consonances in the notes of the Tristan chord ob-oboes/ cl-clarinets/ bas-bassoons/ cel-celli 62
5.3 Consonances of a minor second in the clarinet and the oboe . . . . . . . . . . . . . . . .
xi
65
xii
List of Figures
2.1 Rhythmic cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
2.2 Beethoven’s 5th symphony . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
2.3 Beethoven’s 5th symphony . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
2.4 Violin’s sound wave
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
2.5 Flute’s soundwave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
2.6 Harmonic Spectrum of C
6
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1 WAV sound on Mathematica
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
3.2 Function to create the list of points for plotting the frequency spectrum . . . . . . . . . . .
15
3.3 ListPlot of the coordinates calculated for the Frequency Spectrum . . . . . . . . . . . . . .
15
3.4 Function to transform the spectrum into a weight function depending on the harmonics of
the sound (Case 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
3.5 Function to transform the spectrum into a weight function depending on the harmonics of
the sound (Case 2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
3.6 ListPlot of the Frequency Spectrum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
3.7 Critical bandwidth as a function of centre frequency . . . . . . . . . . . . . . . . . . . . .
19
3.8 Plomp and Levelt’s results for consonance on a fraction of the critical bandwidth . . . . .
20
4.1 Fifths spiral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
4.2 Commas on a scale starting on C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
4.3 Pythagoras’ experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
4.4 Scheme of a classic meantone scale, option 1
. . . . . . . . . . . . . . . . . . . . . . . .
27
4.5 Generalized form of constructing α-comma scales starting in C . . . . . . . . . . . . . . .
27
4.6 Scheme of a transformed quarter-comma meantone scale, option 2 . . . . . . . . . . . .
27
4.7 Scheme of a transformed 16 -comma meantone scale . . . . . . . . . . . . . . . . . . . . .
28
4.8 Plot of the function g(x) = e
−(0.005x−0.005)
. . . . . . . . . . . . . . . . . . . . . . . . . . .
30
4.9 Plot of the instruments’ average weight function . . . . . . . . . . . . . . . . . . . . . . . .
31
5.1 The different notes C in scientific pitch notation . . . . . . . . . . . . . . . . . . . . . . . .
34
5.2 Representation of a string with an applied tension [Benson, 2007] . . . . . . . . . . . . .
34
5.3 Harmonic spectra of the open string G and the note C positioned in the same string . . .
37
5.4 Harmonic spectrum of violin’s open string A . . . . . . . . . . . . . . . . . . . . . . . . . .
37
xiii
5.5 Harmonic spectra of D open string and second harmonic . . . . . . . . . . . . . . . . . .
38
5.6 Harmonic spectrum of viola’s open string C . . . . . . . . . . . . . . . . . . . . . . . . . .
39
5.7 Open strings in the cello . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
5.8 The first three modes of displacement nodes and antinodes for an open tube. N stands
for node [Henrique, 2011]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
5.9 The first three modes of displacement nodes and antinodes for a closed tube [Henrique,
2011]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
5.10 Representation of displacement in a conical tube [Benson, 2007]. . . . . . . . . . . . . . .
43
5.11 Harmonic spectra of the notes C in the flute range . . . . . . . . . . . . . . . . . . . . . .
44
5.12 Harmonic spectra of notes in the oboe range: C4, F4, C5, C6 and F6. . . . . . . . . . . .
45
5.13 Harmonic spectra of the notes involved in the "break". . . . . . . . . . . . . . . . . . . . .
46
5.14 Harmonic spectra of notes in the clarino register. . . . . . . . . . . . . . . . . . . . . . . .
47
5.15 Clarinet high sound B[6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
47
5.16 Bassoon’s harmonic spectrum of the sound C2. . . . . . . . . . . . . . . . . . . . . . . . .
48
5.17 Bassoon’s harmonic spectrum of C3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
48
5.18 Trumpet’s harmonic spectrum of the sound B[3. . . . . . . . . . . . . . . . . . . . . . . . .
51
5.19 Trumpet’s harmonic spectrum of the sound B[5. . . . . . . . . . . . . . . . . . . . . . . . .
52
5.20 Horn’s harmonic spectra in different registers. . . . . . . . . . . . . . . . . . . . . . . . . .
52
5.21 Representation of the positions possible in the trombone and the respective harmonics
[Adler, 2002]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53
5.22 Harmonic spectra of a trombone playing a C in three different registers. . . . . . . . . . .
54
5.23 Harmonic spectra of an F tuba. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
5.24 The vertical and horizontal tensions in the membrane. . . . . . . . . . . . . . . . . . . . .
56
5.25 Representation of the Bessel functions J0 (x), J1 (x), J2 (x) and J3 (x). . . . . . . . . . . . .
58
5.26 Stationary points formed by the solutions of equation 5.21 [Benson, 2007]. . . . . . . . .
59
5.27 Harmonic spectrum of a snare drum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
5.28 Harmonic spectrum of violin’s A3 and respective interpolation . . . . . . . . . . . . . . . .
61
5.29 Music score of the instruments playing the Tristan chord [Wagner, 1912]. . . . . . . . . .
62
5.30 The bassoon spectrum of B3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63
5.31 Music score of the symphony opening [Beethoven, 1826]. . . . . . . . . . . . . . . . . . .
64
5.32 Spectrum of the celli playing the note A2 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
65
xiv
Chapter 1
Introduction
Music is usually seen uniquely as a field of the arts. However, a deep research in this area implies the
use of physics, mathematics and history. How can someone master the art of playing an instrument
without understanding what sound is, and how it works? Therefore, every musician has an idea of this
matter, at least intuitively. Throughout this thesis, the intention is to deepen these intuitive notions with
mathematical concepts.
The main areas in mathematics that will be used are:
• Number theory, used to represent numerical intervals in a musical scale;
• Algebraic notions and vector spaces for the calculation of consonance;
• Fourier theory for the representation of the frequency spectrum of a sound;
• Differential equations to represent the wave equation of a sound.
Number theory is applied in the sense that the relation between different notes in a scale can be
represented by numbers, more specifically, fractions. Operations with these numbers have its equivalent
in a musical perspective. For example, adding two intervals of a scale is the same as multiplying their
representative fractions.
This is a way of defining numerically a note in a scale, but we can also describe it by a vector. A
vector of a sound contains the resonant frequencies that constitute it. Instead, it may also contain the
weights of the intensity correspondent to each frequency.
The two areas mentioned above shall be useful to calculate consonance ahead. As for the last two,
will be used in the mathematical analysis of the instruments in the orchestra. After recording the sounds
we can find an equation defining the soundwave and discover the harmonic spectrum, by using the
Fourier transform.
Although covering many subjects, the main idea of this thesis is to combine them in a common goal:
an attempt to demystify some rumours in music, using mathematical concepts.
1
1.1
Organization
This thesis is organized by chapters with the following contents:
• Chapter 2 provides some definitions of sound and consonance in a mathematical point of view.
This is followed by an introduction to the Fourier Analysis and the way of calculating a soundwave.
• Chapter 3 is the core of the whole thesis. Given that a big part of it was programming in Mathematica the functions needed to analyse harmonic spectra and consonance, it’s important to understand
how this layer works. So, in this chapter we present every step to calculate consonance, which
includes different notions of psychoacoustics, mathematics and also timbre. For the last of these
characteristics we also need a method to obtain the frequency spectrum of a sound, which is also
part of the contents in this chapter.
• In chapter 4 it is introduced the definition of musical temperament. We also give a brief explanation
and historical background for the construction of each temperament. Afterwards, the methods
described in the previous chapter are applied to the defined temperaments.
• The diversified chapter 5 contains the calculation of the soundwave equation and the harmonic
spectra for each group of instruments. A characterization of each instrument is presented along
with an individual analysis of its sound. Finally, some orchestral parts are used to combine the use
of all the computational methods explained in chapter 3.
• In chapter 6 are presented some final conclusions on all subjects mentioned above. Also, some
ideas and future work are suggested to continue the paths created throughout this thesis.
2
Chapter 2
State-of-the-art
2.1
What is sound?
Young people usually learn music by singing the notes of a scale and intuitively corresponding to each
note one sound. But that is not how it really works. When a note is played on a string or wind instrument the sound is formed by different frequencies. This matter was studied by many mathematicians
and musicians through centuries, such as Marin Mersenne, Johann Sebastian Bach, Leonhard Euler
and Jean-Baptiste Joseph Fourier. We know that when an instrument sounds at a certain pitch, with
frequency f , that sound is essentially periodic with the frequency f . According to the theory of Fourier
series, a sound is decomposed into a sum of sine and cosine waves at integer multiples of the frequency
f . We call to the component of the sound with frequency f , the fundamental and the components with
frequencies m × f , m ∈ N, the mth harmonics. Some instruments only have some harmonics when
playing a note, for example, when playing a note of frequency f on the clarinets the only harmonics composing the sound are the odd ones. For this instruments we use the designation of mth partial which is
the mth frequency component counted from the fundamental. We can also use the term overtone for all
the partials of a note at a certain pitch, except the fundamental.
When a sound is produced, there are other important components we should consider:
• Pitch, usually measured through frequency (in Hertz).
• Timbre, which defines the quality of the sound of a certain instrument.
• Intensity, distinguishes different ways of producing a sound. For example, one can play or sing a
note softly or in a more stressed way.
• Duration, can be measured in seconds or, in a more relative way, through rhythm.
Although we shall not use this definition ahead, it is an important matter of musical knowledge that
an interested reader might like to know.
Definition and example 1 (Rhythm). A rhythm can be written with the use of rhythmic cells. These cells
are represented in figure 2.1. At the bottom of the image we have what is called a whole note, the one
3
below it is called a half note, the next a quarter note and so on. Two of the rhythmic cells below last
exactly the same period of time as one of the cells above. So the rhythmic cells are a division by 2n of a
whole note.
Figure 2.1: Rhythmic cells [Denis, 2011]
But now you must be questioning how long does one of the notes take in seconds. Let’s look at a
music sheet of Beethoven’s 5th symphony in figure 2.2.
Figure 2.2: Beethoven’s 5th symphony [Beethoven, 1989]
4
Let’s see closer:
Figure 2.3: Beethoven’s 5th symphony
The expression Allegro con brio tells us something about the music character, therefore about the
tempo. Allegro means fast and con brio means vigorously, so we have the information we need about
the character of this piece. On the right side of this expression we also have an indication of the half
note time, that should be 108 beats per minute (bpm). This means we should be able to fit 108 half
notes in one minute, in this piece. Although, we can also say that Beethoven was quite optimistic with
the instrumentalists and he composed many fast pieces that the interpreters, nowadays, play a little bit
slower. Of course, Beethoven’s pieces can be played slower just because one decides that it fits the
music better, it is a matter of taste.
It is also important to give a better notion of what timbre is. When we hear a violin and a flute playing
exactly the same note at the same time and pitch, what distinguishes the sound of both instruments is
their timbre. The term tone color is also used to describe quality of sound, for example, each instrument
has it is own color in the orchestra and all together sound like a beautiful painting.
Instruments have different timbres due to two issues. Some instruments may have more harmonics
than others, we had given the example that a note played by a clarinet only has odd harmonics. What
also affects the timbre is that each harmonic of a note can vary in intensity from instrument to instrument.
The intensity naturally decays in the high pitch harmonics, but in each instrument it decays differently.
That decay is given by the frequency spectrum of a sound which will be studied next, in section 3.3.2.
This can also be realised by checking the differences in the form of different instruments’ soundwaves.
For example, the following figures represent the soundwaves of a violin and a flute playing the exact
same note.
0.05
50
100
150
-0.05
Figure 2.4: Violin’s soundwave
5
200
250
0.20
0.15
0.10
0.05
50
100
150
200
250
-0.05
-0.10
-0.15
Figure 2.5: Flute’s soundwave
Timbre is also characterized by the attack of the sound caused by the instrument. By attack we mean
that a note sounds much louder the instant moment when it is played than the rest of the time we still
hear it. The piano, for instance, has a natural attack of each note because each sound is caused by a
hammer hitting a string. Now you must be questioning why isn’t this attack of the notes in the piano a
matter of intensity of the sound. Well, we shall use this term when intensity is consciously produced,
and not a natural attribute of the instrument.
2.2
What is consonance?
Now we shall return to the matter of the harmonics that constitute sound. All the harmonics of a note
are called its harmonic spectrum. The figure 2.6 illustrates the notes given by the harmonic spectrum
starting on C.
Figure 2.6: Harmonic Spectrum of C [Benson, 2007]
The definition that follows is very important for all the matters in this thesis.
Definition 1 (Interval). An interval is a combination of two notes at different or equal pitch. It can be
represented by the ratio between their frequencies.
A combination of two notes can also be called a dyad and a combination of more than two is a chord.
The two notes can be played at the same time and the interval is harmonic or one after another and the
interval is melodic. It is important to mention that the harmonics of a note which have the double of the
pitch of others, are all the same note, but octaves apart.
6
Example 1 (Interval Ratios). If we consider the note A at a pitch of 440 Hz, its harmonics are:
• Fundamental: 440 Hz
• Second harmonic: 440 × 2 = 880 Hz
• Third harmonic: 440 × 3 = 1320 Hz.
This way we obtain the harmonics of the note. To know the intervals between the pitches of the
harmonics we do 1320/880 = 3/2. A 3/2 interval is also called a fifth interval because the note at pitch
1320 Hz is E.
The same way we can calculate the ratios for other intervals:
Unison
Minor Tone
Major Tone
Minor Third
Major Third
Fourth
Fifth
Minor Sixth
Major Sixth
Octave
1/1
10/9
9/8
6/5
5/4
4/3
3/2
8/5
5/3
2/1
Table 2.1: Ratios of the most important intervals
Definition 2 (Octave). An octave is an interval such that its frequency ratio is 2/1 and the notes played
are the same with the difference that one is higher in pitch. By the expression intervals in an octave we
mean that the interval is between two notes that form an octave.
It is also important to define some operations with intervals and how they affect the respective ratios.
Let a and b be the ratios of the intervals A and B, a, b ∈ Q+ .
• Add two intervals (A + B): a × b.
• Subtract two intervals (A − B): a × b−1 .
• Complement of the interval in an octave (Ac ): a−1 × 2.
When two notes are played together in an interval this implies a superposition of two harmonic
spectra. Sometimes, this interval can sound bad, in our audible perception. This occurs when the notes
played have harmonic spectra with few harmonics in common. Let us refine this notion.
Definition 3 (Consonance). Consonance exists when two notes in different pitch are played at the same
time and sound pleasant together. This happens when these two notes have partials of the fundamental
frequency in common. Also, the interval is more consonant if the partials in common are the ones that
resound more, that is, the partials of smaller order [Helmholtz, 1954].
The purpose of tuning instruments is to provide a superposition of two harmonic spectra with the
maximum number of harmonics in common, and when this happens the interval is called acoustically
pure.
7
2.3
2.3.1
Soundwaves and Fourier Analysis
Wave equation and the Beats phenomenon
Musical instruments are mechanic-acoustic systems since they are constituted by two types of vibrations. The ones in a solid object, the instrument itself, and the propagation in a fluid, which is the air in
the acoustic point of view. This vibrating movements are periodic oscillations yielding a simple harmonic
motion [Henrique, 2011].
This SHM is described by the following differential equation:
∂2x
= −kx ⇐⇒ ẍ = −kx,
∂t2
(2.1)
where k is a constant. This means that an object suffering from a perturbation has a movement with
acceleration proportional to the distance from the equilibrium position. If we think about this movement
with a particle of mass m, the force of the perturbation is described by
F = −kx = mẍ =⇒ ẍm + kx = 0 ⇔ ẍ +
k
x = 0,
m
(2.2)
and so, the solutions for this equations are
r
x(t) = A cos(
k
t) + B sin(
m
r
k
t),
m
(2.3)
where A = c sin(φ) and B = c cos(φ).
The sinusoidal movement is described by x(t) = A sin(ωt + φ) where ω is the angular velocity or
frequency of the movement, in rad s−1 , and φ is the initial phase, in rad. The angular frequency depends
on the linear frequency, in Hertz, as ω = 2πf . The sinusoid expression can be a solution of equation
(2.2), as we check in the following steps:
∂2x
= −Aω 2 sin(ωt + φ);
∂t2
(2.4)
−mAω 2 sin(ωt + φ) + kA sin(ωt + φ) = 0
(2.5)
(−mω 2 + k)A sin(ωt + φ) = 0.
(2.6)
Replacing on the equation we get:
Considering the points where A sin(ωt + φ) 6= 0 then −mω 2 + k = 0. Therefore we obtain the relation
q
q
k
1
k
or f = 2π
ω= m
m.
Given that a sound produced by an instrument or human voice, is a superposition of pure sounds,
it consists in a superposition of sine waves. To understand how this works, we analyse the Beats
phenomenon. Beats are used for tuning instruments, and that’s done by adding two sounds. Suppose
we’re trying to tune two sounds at the note A 440 Hz. One of them is already in 440 Hz and the second
8
one in 444 Hz, therefore out of tune. We assume equal amplitudes since they are the ones evidencing
this phenomenon, and we add the two soundwaves:
A sin(880πt) + A sin(888πt) = 2A sin(884πt) cos(4πt).
(2.7)
This means we hear a sine provided by the average of the two tuning frequencies and a slow cosine
with a 2 Hz frequency. Therefore we have two maximums and two minimums of the cosine function
happening during a second, and these four peaks are the beats. So, for a tuning purpose the technique
is trying to reduce the number of beats until none is heard. Thus, the number of beats is the exact
difference between the two pitches. Generalizing, we have:
A sin(m2πt) + A sin((m + n)2πt) = 2A sin((2m + n)πt) cos(nπt),
(2.8)
where m is a reference pitch and n the difference between the tuning pitches.
2.3.2
Fourier Series
As we have seen, sound is a propagation of periodic waves. This happens trough the vibrating harmonics of a certain fundamental pitch. Thanks to Fourier theory, we can decompose this sound into a sum of
sine and cosine waves, each corresponding to the vibration for a harmonic. We know that every function
defined in the following manner,
∞
X
1
(an cos(nθ) + bn sin(nθ)),
f (θ) = a0 +
2
n=1
(2.9)
is periodic with period 2π. But how can we reverse this thought so that we obtain such a parametrization
for every periodic wave? First, we must understand how the Fourier coefficients an and bn are calculated:
Z
∞
X
1
cos(mθ)( a0 +
(an cos(nθ) + bn sin(nθ)))dθ
2
0
n=1
Z 2π
Z 2π
Z 2π
∞
X
1
cos(mθ)dθ +
(an
cos(mθ) cos(nθ)dθ + bm
cos(mθ) sin(nθ)dθ)
= a0
2
0
0
0
n=1
2π
Z
2π
cos(mθ)f (θ)dθ =
0
1
π
= am π =⇒ am =
and a0 =
1
π
R 2π
0
cos(0)f (θ)dθ =
1
π
R 2π
0
2π
Z
cos(mθ)f (θ)dθ
m 6= 0,
(2.10)
m ≥ 1.
(2.11)
0
f (θ)dθ.
The bn coefficients can be found in a similar manner:
bm =
1
π
Z
2π
sin(mθ)f (θ)dθ
0
Since we are interested in defining a function F for which the period might not be 2π, we take
9
θ = 2πf t, where f =
1
T
, and T is the period of F . That takes us to a generalization of the Fourier series
definition.
F (t) =
∞
X
1
a0 +
(an cos(2nπf t) + bn sin(2nπf t)),
2
n=1
Z
(2.12)
T
am = 2f
cos(2mπf t)F (t)dt
m≥0
sin(2mπf t)F (t)dt
m ≥ 1.
0
Z T
bm = 2f
0
Since we obtain the Fourier coefficients trough an integral, possible discontinuities of function F are
not represented using the Fourier approximation (2.12). Although, it is required that the function F has
some continuity characteristics in order to use the Fourier series.
Theorem 1. Let F be a periodic function with period T , continuous and having a bounded continuous
derivative except in a finite number of points in [0, T ]. Then, the Fourier series, having coefficients as
defined above, converges to F (t) at all points where it is continuous.
Of course that if F is C 1 , the above theorem applies.
Alternatively, Fourier series has also a complex version:
F (t) =
∞
X
cn e i
2πnt
T
(2.13)
n=−∞
cn =









2.3.3
1
2 (an
− ibn )
if n > 0
1
2 a0
1
2 (a|n|
if n = 0 =
1
T
Z
T
F (t)e−i
2πnt
T
dt
0
− ib|n| ) if n < 0
Fourier Transform
Now that we know how to approximate a soundwave by a Fourier series, we also want a method that
allows us to get information about its frequency spectrum. This will give us a characterization for the
timbre of instruments and the decay of the harmonics. This can be obtained by using the Fourier
transform which converts signals from a time domain to a frequency domain. The Fourier transform is
given by:
fˆ(ω) =
Z
+∞
f (t)e−2πiωt dt, f ∈ L 1 .
(2.14)
−∞
So we are transforming the domain of f to frequencies ω. The reverse process is also possible, by
using the inverse Fourier transform:
Z
+∞
ǧ(t) =
g(ω)e2πiωt dω.
(2.15)
−∞
To apply this transforms the function in question must be an integrable function with real domain. By
10
integrable function we mean that
R
|f |dµ < +∞. The behave of the transform is characterized by the
Riemann-Lebesgue lemma, which states that the Fourier transform of an integrable function tends to
zero when the frequency tends to infinity, like the following representation:
Z
+∞
f (t)e−2πiωt dt = 0.
lim
ω→∞
(2.16)
−∞
The Fourier transform defined above is used for a continuous infinite domain. Although, when the
available data is a wave in sound format, it is necessary to work with samples of the sound. Sampling
implies that we have a list of the soundwave amplitudes in equally spaced points in time. So we must
apply to this list the discrete Fourier transform which basically works in a similar manner as the continuous version, but in a finite and discrete domain. To describe the whole process, first we imagine the
continuous and realistic version of the soundwave, f . When sampling the wave what we perform is an
assumption of discrete time so that f (t) → f (tk ) = fk and tk = k∆, where ∆ is the gap size between
two values in time. If we have a list of N samples then k = 0, ..., N −1 and the Discrete Fourier Transform
is defined as follows:
Fn =
N
−1
X
fk e
−2πink
N
(2.17)
.
k=0
The output of this transformation is a complex number containing information on the amplitude and
phase of the sinusoid, in a frequency domain. For the purpose of calculating the frequency spectrum of
a sound we only need the amplitude of each component, and so we only consider |Fn |.
The result of applying (2.17) has periodicity N since Fn+N = Fn , as we check next,
Fn+N =
N
−1
X
fk e
k=0
−2πi(n+N )k
N
=
N
−1
X
fk e
−2πink
N
k=0
e|−2πik
{z } =
1
N
−1
X
fk e
−2πink
N
= Fn .
(2.18)
k=0
So we’re only interested in looking to a domain where n ∈ 0, ..., N − 1 which in a practical point of
view means we reduce the frequency domain to the range of human audible frequencies, after applying
the Discrete Fourier Transform.
11
Chapter 3
Computing consonance
In this chapter it will be presented a program to compute consonance. The program receives an input
of two fundamental frequencies in hertz and outputs a relative consonance from 0 to 1. A program to
compute such definition has to take into account some characteristics of sound, that’s why we shall do
it in three steps:
• 1st step: Group equal frequencies between the harmonics of the two fundamental notes, in order
to see if there are some in common. If there are many in common, by the definition of consonance,
we get higher consonance. Otherwise, the notes given by the fundamental frequencies in the input
may sound harsh together.
• 2nd step: Apply to the 1st step the frequency spectrum. In other words, we have that the higher
the m ∈ N of the mth harmonic then less it resonates when a note is played. This decay depends
on the instrument that is playing the note because, as we’ve seen, it characterizes the instrument’s
timbre.
• 3rd step: Induce an impure ear on the program. By this we mean that the program must group
frequencies not only equal but also in a confidence interval of each other. This error has to be
induced because human ear sometimes can’t distinguish the difference of 1 or more hertz between
frequencies.
This program was designed by the author, based on the definition of consonance by Helmholtz. The
steps described above were inspired in the chapter 4, "Consonance and dissonance" of Benson’s book
Music: A Mathematical Offering [Benson, 2007].
Before computing the consonance we must first obtain the frequency spectra for different instruments
that will be used in the 2nd step. For this purpose, the correspondent recording and programming
process will be described in advance. The most important functions created to implement all the steps
are attached in appendix, in chapter 7.
12
3.1
Recording orchestral instruments
This section serves mainly as a brief report of how the sounds used throughout the thesis were recorded.
This recording process was performed in the anechoic chamber of Instituto Superior Técnico. This type
of chamber disables reflections and insulates from the outside noises. The walls are coated with an
absorbent material made of glass wool.
The instruments were recorded with a condenser microphone which transforms the sound pressure
sensed in the micro’s membrane into electric current. An external soundcard was also used to control
the recording set. The resultant sounds of this process are in WAV format, which is an uncompressed
sound format. This is used to obtain the best representation of the amplitude relation in the recording.
Also, the resultant sound is sampled with a 44100 Hz rate, whose meaning will be explained in the
following section.
Finally, the recordings were performed with original orchestra instruments and by music students of
the Academia Nacional Superior de Orquestra. The precautions to record each of the instruments were
taken, this means keeping the same distance to the microphone and directed to the instruments. The
results of the recording session were extremely satisfactory due to the sound quality and the absence of
noise.
3.2
Calculation of the frequency spectra
To calculate the frequency spectra of the recorded sounds, we use Mathematica. This platform allows
importing WAV files and shows a representation of the soundwave, as we can see on figure 3.1.
2.49 s È 44 100 Hz
Figure 3.1: WAV sound on Mathematica
The data received by the Import command is a list of amplitudes of the wave like the one shown
above. To understand how this amplitudes relate with the soundwave in its time domain, we first must
define some concepts.
Definition 4 (Sampling Rate). The Sampling Rate or Sampling Frequency is the number of samples
obtained in one second of a signal. That is, the number of data kept in the list, correspondent to one
second in the time domain.
The sampling rate most commonly used to record a sound is 44100 Hz. This value is taken due to
the results of the following theorem.
13
Theorem 2 (Nyquist-Shannon sampling theorem). If a function f contains no frequencies higher than
B Hz, it is completely determined by giving its ordinates at a series of points spaced
1
2B
seconds apart.
Follows the brief proof on Shannon’s paper [Shannon, 1949]:
Proof. Let F represent the spectrum of the soundwave f . Then, using the Inverse Fourier Transform
depending on the angular frequency we get,
f (t) =
1
2π
Z
∞
F (ω)eiωt dω =
−∞
1
2π
Z
2πB
F (ω)eiωt dω.
(3.1)
−2πB
ω
| < B.
Since no frequency is bigger than B Hz we can assume that F is zero outside the band | 2π
According to the statement, the samples are collected when t =
f(
n
1
)=
2B
2π
Z
2πB
n
2B ,
n ∈ Z and so,
n
F (ω)eiω 2B dω.
(3.2)
−2πB
The integral on the right is essentially the nth coefficient of a Fourier series expansion of F , therefore,
the function is determined if its Fourier coefficients are determined. If F is determined then we obtain
f by applying the inverse Fourier Transform. This way, we only need the signal’s information on t =
n
2B ,
n ∈ Z.
Since the human hearing range goes from 20 Hz to 20 kHz it makes sense that the sampling rate is
near the double of this interval, therefore the regular use of 44100 Hz. Lower sampling rates would lead
to aliasing, the phenomenon of reconstructing a sampled signal different from the original continuous
signal. Using the appropriate sampling rate prevents the distortion of the sampled results. Although,
there are still some imperfections in the data recorded, like noise, for example. The best way to reduce
it is to calculate the Discrete Fourier Transform in different parts of the sound and then take the average
of the results. This procedure is called Welch’s method and it is based on the following steps [Welch,
1967]:
• The signal to be analysed is split up into D overlapping segments, each of length L. The overlapping occurs in N points;
• The Discrete Fourier Transform is applied to all D segments;
• We take the average of the amplitudes calculated for each segment.
When applying Welch’s method, it is reasonable not to use the whole soundwave, specially because
there are instabilities in the reproduction of a sound, specially in the beginning and the end of its recording. The choice of variables D, L and N must allow a good interpolation of the frequency spectrum.
Therefore, to have at least 3 to 4 segments we consider N = 5000 and L between 30000 and 50000. The
choice of this last value is made taking into account the duration of the sound. For example, in a sound
with more than two seconds, L = 40000 is appropriate since it allows the selection of a segment in the
middle of the wave.
14
The resultant data consists on complex numbers, so we select the absolute values, in order to obtain
a list of the sampled amplitudes in a frequency domain. If we took the square of this values we would
obtain the Power Spectrum of the sound, but there’s no point in that since we intend to reduce the
amplitude to a scale from 0 to 1.
Finally, to represent the plot of the frequency spectrum we must know the frequency correspondent
to each amplitude. Let data be the list of amplitudes in a frequency domain, L the length of the list and
rate the sampling rate. If the gap between samples in the time domain is
1
rate
then in the frequency
domain the gap will be
rate
L .
Therefore, the coordinates in the frequency domain correspondent to the
amplitudes in data are
n rate
L ,
n ∈ 0, ..., L − 1. The code representation in Figure 3.2 does the procedure
explained above, limiting the frequency domain to an audible range.
1
audibleCoordinates=Function[{data,rate},
2
Select[Transpose[{Range[0,(Length[data]−1)](rate/Length[data]),data}],
3
#[[1]]<=20000&]];
Figure 3.2: Function to create the list of points for plotting the frequency spectrum
This allows drawing the ListPlot of the coordinates calculated.
10
8
6
4
2
5000
10 000
15 000
20 000
Figure 3.3: ListPlot of the coordinates calculated for the Frequency Spectrum
Our interest now is to turn the amplitudes in the frequency spectrum into a weight function, which
means, the peak amplitude must have the value 1 and the others decrease until zero. For that purpose
we divide all the amplitudes by the peak amplitude. Now we want to obtain the weight function depending on the harmonics. That is, we must transform the domain in frequencies into a domain of natural
numbers corresponding to the harmonics. Therefore, we must divide each frequency by the fundamental one, and this is not always an easy procedure. Let us suppose that the peak amplitude corresponds
to the fundamental frequency. In that case we consider a list of points x as the input, then the following
routine solves this issue:
15
1
2
3
convertToHarmonics=Function[x,Module[{list1,list2,newList1,newList2},
list1 =Map[#[[1]]&,x];
list2 =Map[#[[2]]&,x];
4
newList1=list1(1/ list1 [[ Position[ list2 ,Max[list2 ]][[1,1]]]]) ;
5
newList2=list2/Max[list2 ];
6
Transpose[{newList1,newList2}]]];
Figure 3.4: Function to transform the spectrum into a weight function depending on the harmonics of the
sound (Case 1)
But let us consider a case where the maximum amplitude doesn’t correspond to the fundamental.
Ahead, we’ll acknowledge that this happens usually for sounds of lower pitch. So, in this case we
don’t need to find the maximum, but the point correspondent to the first peak in the spectrum. This is
rather hard since the points of the spectrum oscillate constantly in small amplitudes. So, to achieve an
accurate result we must use an external reference of frequency. For example, we can identify that a
sound corresponds to a specific note, and there are already reference frequencies of the fundamental
for the notes in a scale.1 Let’s say that the sound has pitch f and the fundamental doesn’t correspond
to the highest amplitude. In this case we apply the alternative function represented in the following
Figure 3.5.
1
convertToHarmonicsNotFundamental=Function[{x,f},Module[{list1,list2,selectList,max,newList1,newList2},
2
list1 =Map[#[[1]]&,x];
3
list2 =Map[#[[2]]&,x];
4
selectList =Select[x,#[[1]]<= f+20&&#[[1]]>=f−20&];
5
max=Max[Map[#[[2]]&,selectList]];
6
newList1=list1(1/ list1 [[ Position[ list2 ,max ][[1,1]]]]) ;
7
newList2=list2/Max[list2 ];
8
Transpose[{newList1,newList2}]]];
Figure 3.5: Function to transform the spectrum into a weight function depending on the harmonics of the
sound (Case 2)
In this case we restrict the search of a maximum amplitude to a small interval [f −20, f +20]. The size
of the interval was decided according to the minimum relevant pitch distance making the differentiation
between two notes. The reason why we don’t use immediately the frequency f to obtain the spectrum
is because we might not recognise that the sound can be slightly out of tune and that would lead to a
spectrum with peaks lagged of the harmonics.
Finally, the spectrum representation is drawn into Figure 3.6.
1 This
can be found in [Henrique, 2011] and also in [Suits, 1998-2013].
16
0.8
0.6
0.4
0.2
5
10
15
Figure 3.6: ListPlot of the Frequency Spectrum
The interpolation from this discrete list of points to a continuous function shall be discussed ahead,
in section 5.5. After interpolation we reach the format of the weight function we want in section 3.3.2, so
we can use it in the Consonance program.
3.3
3.3.1
A program to compute consonance
1st step: Grouping frequencies
This first step is quick and easy, there are only two things to do. First, it is created a list of all the first n
harmonics, n ∈ N, of a note with a certain fundamental frequency f . These harmonics of the note are
then reduced to one octave, that is, they are divided by two until they belong to the range [f, 2f ]. This
list is not infinite since the intensity of the harmonics decays and around the 25th harmonic there’s no
significant influence in the resonance of the sound.
Then, using two notes and their lists of harmonics, it is possible to count the number of times a
frequency in the list of the first note appears in the list of the second note. This process is applied to
every single harmonic in the first note. Using the operation of Mathematica, DeleteDuplicates, with the
last result we obtain a list of all the harmonic frequencies of both notes and the number of times they
exist in common.
3.3.2
2nd step: Notion of timbre in the program
As it was mentioned in the previous chapter, the timbre of a sound is defined by the format of its sound
wave. This reflects on the frequency spectrum, and we already created a way to find it in section 3.3.2.
For the case of the temperaments that shall be approached in chapter 4, we will use a simplification
of this notion. We’ll approximate the decay of a spectrum by the function g(x) = e−(0.005x−0.005) . This
approximation is not realistic for each instrument itself but what we want in this case is a weight function
that decays slowly. We will deepen the reasons for the use of this function later. So either a frequency
17
spectrum or the type of function mentioned above shall be treated as a weight function to the construction
of the program.
Suppose now that we want to know the consonance of the interval consisting on two notes A and
B with different fundamental frequencies f1 and g1 . We also have a weight function for each note, w
and p for notes A and B, respectively. These weight functions relate the nth harmonic with its relative
amplitude w(n) := wn . The same is assumed for the function g.
The notes A and B can be represented by the following lists: {f1 , f2 , ..., fn } and {g1 , g2 , ..., gn } where
fi and gi , i ∈ {1, 2, ..., n}, are the frequencies of the ith harmonics of notes A and B, respectively. The
natural number n is the same for both lists because we shall restrict n to be 30, since higher harmonics
are not audible.
Since we know from the 1st step how to group equal frequencies from two different notes, let
{(fl1 , gj1 ), ..., (flm , gjm )}, l, j ∈ {1, 2, ..., n} be the list of the pairs of frequencies grouped, where fl1 =
gj1 , ..., flm = gjm . Using this we can construct a vector v = (wl1 pj1 , ..., wlm pjm ) multiplying the weights
of each partial in common. The consonance of the interval between notes A and B is, therefore, given
by:
c(A, B) =
kvk
.
k (w1 p1 , ..., wn pn ) k
(3.3)
This formula takes the vector v, giving to each harmonic in common a total weight. This vector is
consistent with the concept of weight because the multiplication of values between 0 and 1 preserves
the same scale. We take the euclidean norm of this result and then divide it by the norm of a vector
calculated in the same way, but for the case of the unison. So, we get a consonance measured from 0
to 1 which has the maximum value if the interval is a unison in equal or different timbres.
3.3.3
3rd step: Critical Bandwidth
It is certain that we can obtain the consonance of an interval, but our problem now is that our ear is not
as perfect as our program. For example, if we compute the consonance of an octave, like the interval
caused by two notes at different pitches 100 Hz and 200 Hz, we’ll probably obtain a consonance near 1.
Although, if we use the frequencies 101 Hz and 200 Hz the program will output a consonance very close
to 0. This happens because the partials of the two fundamental frequencies are completely de-phased.
The problem is that human ear can’t distinguish this small gaps of frequencies and it would find no
difference between the interval using a 100 Hz pitch and the other one with 101 Hz. It is important now
to define a criteria for this range of frequencies that the human ear reacts as being at the same pitch.
Our ear works like a filter, which lets through frequencies in a certain band, and blocks out the ones
outside that band. The range of frequencies which pass, belong to what’s called the Critical Bandwidth.
This means that each time we hear a sound at a frequency f and then vary the pitch on a certain interval
in hertz, our ear can’t distinguish if we’re still hearing the same sound or not. That interval is the critical
bandwidth of the original frequency f . The critical bandwidth varies according to the central frequency
of a note as in the graph 3.7.
18
Critical Bandwidth in Hz
1000
800
600
400
200
0
0
1
2
3
4
5
Centre Frequency in KHz
Figure 3.7: Critical bandwidth as a function of centre frequency
A good approximation to this graph, that only doesn’t work very well on low frequencies, is the
following function [Smith and Abel, 1999]:
3
(3.4)
CB = 94 + 71F 2 .
CB is the critical bandwidth in Hz and F the central frequency in kHz. So you can have a clearer
notion of what these graph and equation represent, let’s see an example.
Example 2. An instrument plays a note at a frequency of 1000 Hz, and then it tunes the note from
3
850 Hz to 1150 Hz. Since the CB of 1000 Hz is 94 + 71 × 1 2 = 165 what our ear recognizes when
changing the frequency, is still the same note. Although, we may start to notice that the note is out of
tune, the closer its frequency reaches the endpoints of the interval [850, 1150].
So, as the the example above shows, when a note’s frequency withdraws from the central frequency,
the dissonance between them increases. A model of this decay of consonance between close frequencies was carried out by Plomp and Levelt who worked on an experimental analysis of consonance and
dissonance [Plomp and Levelt, 1965]. The equation obtained for this was:



1 − 4|x|e1−4|x| , |x| <





 0, |x| ≥ 1 .
4
19
1
4
(3.5)
Level of Consonance
1.0
0.8
0.6
0.4
0.2
0.4
0.2
0.2
0.4
x Critical Bandwidth
Figure 3.8: Plomp and Levelt’s results for consonance on a fraction of the critical bandwidth
On the xx axis we have the central frequency of a note when x = 0 and so, the consonance between
two equal frequencies is 1. A total dissonance is obtained when the difference of pitch reaches a quarter
of the critical bandwidth of the central frequency.
To compute consonance we shall use these definitions to create a confidence interval of each frequency. This way, in our program we can group not only equal frequencies but also frequencies on the
range of the interval mentioned before. This will allow the program to output a more realistic consonance
of an interval. Of course it is necessary to attribute to a pitch on the confidence interval of another one,
the relative consonance between them, which would require a weight function modulated by equation
3.5.
To understand how the program works with the definition of critical bandwidth, suppose we have
the same notes used before, A and B represented by lists of the harmonics of each note and their
respective weights: {(f1 , w1 ), ..., (fn , wn )} and {(g1 , p1 ), ..., (gn , pn )} where fi and gi are the frequencies
of the harmonics and wi , pi the respective weights, i ∈ {1, ..., n}. Firstly, we need to combine each pair
(fi , wi ) with all the pairs {(gj , pj )}nj=1 , this way it is possible to compare all the harmonics of the first note
and the second one.
Suppose now that the program is in the process of comparing (fi , wi ) with (gk , pk ), where i, k ∈
3
{1, ..., n}. To fi and gk we apply the function CB = 94 + 71F 2 in order to discover the critical bandwidth
of both frequencies, which we shall call CBf and CBg, for fi and gk respectively. The next step is to
apply Plomp and Levelt’s function 3.5 to
fi −gk
CBf
and to
fi −gk
CBg
to obtain a relative consonance of fi when
belonging to the interval [gk −CBg, gk +CBg] and the same for gk when belonging to [fi −CBf, fi +CBf ].
Let cik be the average value between these values of relative consonance.
Applying this comparison process to all the combinations of harmonics and weights of both notes,
we can finally obtain a vector of the form:
v = (w1 p1 c11 , w1 p2 c12 , ..., w2 p1 c21 , ..., wn p1 cn1 , ..., wn pn cnn ).
(3.6)
In this vector all the weights and relative consonances are multiplied. This adjunct program that outputs
the vector above is called consaux of notes A and B, so v = consaux[A, B].
20
To obtain the final consonance between notes A and B the formula is the following:
c(A, B) =
k consaux[A, B] k
.
k (w1 p1 , ..., wn pn ) k
(3.7)
This adapted version of consonance works similarly to the formula 3.3. The difference is that in this
case we consider the additional weight of the critical bandwidth in the vector v. The normalization is
performed by dividing the euclidean norm of v by the norm of the unison vector. It doesn’t make any
sense to consider the critical bandwidth for the case of the unison since fi = gi where i = 1, ..., n.
21
Chapter 4
Temperaments
Now that we have means to obtain a relative consonance of an interval, we shall use our program to
study a very important matter of music: temperaments. In order to understand what is a temperament,
it is important to define some other musical terms.
Definition 5 (Scale). A scale is a sequence of musical notes in ascending and descending order. The
key of the scale is the same note where the scale begins and ends. The key of the scale can also be
characterized as major, minor, and many others, depending on the different intervals from each note do
the next one of the scale.
A diatonic scale has seven notes with intervals of five major tones and two minor ones.
A chromatic scale has twelve notes which are always separate by a minor tone interval.
From now on we will use only the chromatic scale because it is the tonal system in which music has
been composed and played for many centuries.
The most important matter when constructing a chromatic scale is that it has to begin and end on the
same note. It would be rather good if we could construct it only using pure intervals between the notes
of the scale. Well, it is impossible for chromatic scales, and temperaments are the countless solutions
for this problem.
We’ll see that using pure intervals to tune a scale will lead us to a different note at the beginning and
the end of the scale. This difference is called comma. There are three types of commas, due to different
ways of tuning scales [Asselin, 2000].
• The Pythagorean comma or ditonic comma is the ratio of the interval between twelve consecutive
pure fifths and seven pure octaves.
22
Figure 4.1: Fifths spiral [Benson, 2007]
As we can see on figure 4.1 we can’t create a chromatic scale using the twelve notes obtained by
adding pure fifths because it wouldn’t end on the same note it began. By same note we consider
notes with only pure octaves apart, or in unison.
The ratio of the Pythagorean comma can be easily calculated:
12 f if ths
(3/2)12
312
531441
=
= 1, 013643265.
= 19 =
7
7 octaves
2
2
524288
• The syntonic comma or ordinary comma is the interval obtained by the difference of adding four
pure consecutive fifths and adding two octaves and a pure major third.
The major third of the scale defined by adding four pure fifths, isn’t pure. The ratio of the difference
between the pure and the impure third is:
4 f if ths
(3/2)4
34
81
= 2
= 4
=
= 1, 0125.
2 octaves + 1 major third
2 × (5/4)
2 ×5
80
• The enharmonic comma or diesis is the interval between three consecutive pure major thirds and
one pure octave.
Notice that the octave of a scale can’t be defined by adding three pure major thirds, because the
scale wouldn’t end on the same note it began. And so, the ratio between the impure and the pure
octave is:
1 octave
2
27
128
=
= 3 =
= 1, 024.
3
3 major thirds
(5/4)
5
125
The ratio between a pythagorean and a syntonic comma is usually designated by schisma.
A temperament is a way of compromising the pure fifths of the scale, in order to obtain the rigorous
condition of the pure octave between the beginning and the ending note of the scale. There are many
temperaments created by innumerable music personalities and curiously also by mathematicians. Once,
maths and music were two of the most important matters studied in human society and so Pythagoras,
Euler, Mersenne and Kepler are some of the scientific personalities who created temperaments.
23
Tempered scales have a structured distribution of fractions of the comma by some intervals of the
scale. That distribution varies in different temperaments and gives to each one of them a certain individuality. We shall analyse the most common temperaments used in music and then clarify why it is so
different to use one to another.
Figure 4.2: Commas on a scale starting on C [Asselin, 2000]
4.1
Pythagorean Tuning
Pythagoras was an expert in many areas of human knowledge, music was one of them. Pythagoras did
some experiments and noticed that frequencies with simple integer ratios sound better. Music intervals
with ratios like 21 ,
3
2
are more consonant than others. That’s why Pythagoras created a scale using only
these intervals.
Figure 4.3: Pythagoras’ experiments [Benson, 2007]
The method used was to tune a sequence of fifths, passing by all the twelve notes of the scale. After
tuning twelve fifths we reach the problem of the Pythagorean comma and that’s why the last fifth has to
24
be tuned narrower than the others, by one Pythagorean comma. Depending on the starting note of the
scale, the narrow fifth exists between two notes of a scale, which are historically B and F] or G] and E[.
In this system, a pure fifth minus a pure forth is a Pythagorean whole tone and a pure forth minus two
whole tones is a minor semitone. This semitone is called minor because it is not quite a half of a whole
tone. The whole tone has a ratio of
9
8
and the minor semitone of
28
35 .
8
( 235 )2 =
216
310
shows that a whole tone
and two minor semitones don’t have the same ratio. This happens because of the Pythagorean comma
16
since ( 89 )/( 2310 ) =
312
219
= pythagorean comma.
In short, the Pythagorean temperament’s most characterizing intervals are the eleven pure fifths, a
fifth narrower than a pure one, eight major Pythagorean thirds which are a syntonic comma wider than
a pure one and four major thirds very consonant, a schisma narrower than a pure third.
The Pythagorean temperament’s problem is that most of the thirds are very dissonant which doesn’t
allow to play a major chord that sounds well enough.
Unison
1
Minor Tone
256
243
Major Tone
9
8
Minor Third
32
27
Major Third
81
64
Fourth
4
3
Augmented Fourth
1024
729
Fifth
3
2
Minor Sixth
128
81
Major Sixth
27
16
Minor Seventh
16
9
Major Seventh
243
128
Octave
2
Table 4.1: Ratios of the intervals in a Pythagorean chromatic scale
4.2
Just Intonation
Just intonation includes any kind of temperaments whose intervals are defined by small ratios. Simple
ratios as the octave and the pure fifth are also used in this temperament. Pythagoras only wanted to
work with these intervals because they are, without a doubt, the most consonant following the unison.
The problem is that in the Pythagorean temperament it is almost painful to hear a major or a minor chord,
because the thirds are extremely dissonant. That’s why the just scale uses also a third of a small ratio
5
4.
The fourth, 34 , is also very consonant. All the ratios for the just scale can be obtained by listing the
ratios of the harmonics of the fundamental of the scale. It is possible to find all these ratios by analysing
only the first 30 harmonics of a note.
25
Unison
1
Minor Tone
16
15
Major Tone
9
8
Minor Third
6
5
Major Third
5
4
Fourth
4
3
Augmented Fourth
45
32
Fifth
3
2
Minor Sixth
8
5
Major Sixth
5
3
Minor Seventh
9
5
Major Seventh
15
8
Octave
2
Table 4.2: Ratios of the intervals in a Just chromatic scale
The thirds and sixths in this temperament are called the just ones, the ratios of the major and minor
tones, sevenths and augmented fourth, can change in different kinds of just temperaments. In the just
scale the major chord of the fundamental is called a just major triad because it is constituted only by
pure intervals.
The general problem associated to this kind of temperament is that, for example, if an instrument is
tuned in a just major scale starting on C, the just major triad starting in C sounds very well but a chord
on any other key it is not just and it can sound really harsh. So it is obvious that this complicates any
type of modulation to different keys.
4.3
Meantone Temperaments
The meantone scales are tuned by making some changes to the just ones, in order to make them more
flexible. These adjustments are made to the fifths, by a fraction of the syntonic comma. The classic
meantone scale is the quarter-comma meantone. There are many ways of tuning the 14 -comma scale
because as long as the major third of the fundamental major chord is pure, the remaining notes can be
organized in different forms. Adding and subtracting a
1
4
of the comma to the fifths, summing zero at
the end, is one of those forms. That is, in C’s major scale with classic meantone temperament, the fifths
C-G, G-D, D-A, A-E are all a quarter of the syntonic comma narrower than pure fifths. So, we obtain a
pure third C-E.
One of the ways of rearranging the remaining notes is to keep subtracting a quarter of the comma to
the following fifths and the ones that go down from C. In order to get a twelve note scale, one of the fifths
has to be
7
4
of a comma wider. Using the C scale as example, this extremely large fifth is historically
from B to F] and it is named the wolf fifth.
26
Figure 4.4: Scheme of a classic meantone scale, option 1
On figure 4.4 is represented the method of tuning the 41 -comma temperament described before.
Another way of organizing the remaining notes is to add
1
4
of a comma to some fifths and subtract to
others, summing up zero. This method is used to create what are called transformed meantone scales
1
and it is possible to generalize them to any α-comma meantone scale, where α ∈ [ 11
, 1] ∩ Q.
Figure 4.5: Generalized form of constructing α-comma scales starting in C [Benson, 2007]
The notation used in figure 4.5 can be explained as follows. A note M with −/ + α above symbolizes
that the interval of fifth ending in M is α a comma narrower/wider than a pure fifth. Specifying for the
case with α =
1
4
we obtain the following scheme:
Figure 4.6: Scheme of a transformed quarter-comma meantone scale, option 2
27
Other nice meantone temperament is Sibermann’s, with α = 16 .
Figure 4.7: Scheme of a transformed 16 -comma meantone scale
This temperament works well because the fifths are a little closer to the pure ones, and the thirds
aren’t too different from the ones in the 14 -comma meantone scale.
As it was seen, the meatone scales are more flexible than the Pythagorean and the just because
there are more chords sounding pretty well, and not only the fundamental’s major triad. This allows
the possibility of modulation to some keys, which is almost imperative in classical music from the XVII
century forward. Although, there are some keys to avoid, because of the wolf interval of the scale.
4.4
Equal Temperament
The equal temperament is almost the same as the
1
11 -comma
meantone one. It consists on distributing,
in equal parts, the syntonic comma by the circle of fifths. This induces major and minor tones to be all
the same, and modulating from a key to another turns out to be the same thing only sounding on higher
or lower pitch.
The ratios of this temperament, in figure 4.3, are easy to find because one only has to divide the
octave in twelve equal parts.
28
Unison
1
Minor Tone
2 12
Major Tone
26
Minor Third
24
Major Third
23
Fourth
2 12
Augmented Fourth
22
Fifth
2 12
Minor Sixth
23
Major Sixth
24
Minor Seventh
26
Major Seventh
2 12
Octave
2
1
1
1
1
5
1
7
2
3
5
11
Table 4.3: Ratios of the intervals in an Equal chromatic scale
Equal temperament has been almost the only one used in music since the 19th century. It is a
comfortable way of doing music because it is quite symmetric, but is not usually the best choice. Firstly,
the thirds are all too wide. The fifths aren’t far from pure but any chord played in an equal scale is
practically “ruined” by the thirds. Also, before equal temperament different keys had different “colors”
and now they are a mere transposition of tone. Nowadays, except on some ancient music ensembles,
everything is played using the equal scale. Maybe it will start to change due to some criticism made by
more and more people. One good example is the book How equal temperament ruined harmony (and
why you should care) from Duffin [Duffin, 2006].
29
4.5
Consonance calculations and results for each Temperament
Finally, it is possible to use the program elaborated on chapter 3 to find out which temperaments sound
better in each interval of a chromatic scale. To obtain this, the consonance program was applied to each
ratio of a chromatic scale tempered in a certain way. Since the ratios are numbers from 1 to 2, that
would be problematic when using the concept of critical bandwidth, since the formula 3.4 doesn’t work
well in very low frequencies. Of course, if we consider frequencies from 1 Hz to 2 Hz they are considered
extremely low. That’s why the ratios were all multiplied by a higher frequency, this way the program could
work in good conditions. The frequency used to construct the tables was the classic A in 440 Hz, which
is high enough to compare the consonances on different temperaments. For sure, if a higher frequency
was used, the critical bandwidth would be larger and probably all the values of consonance for each
interval would raise. But that is not a problem because what is interesting to observe now is the way
consonances behave in a relative way, that is, compare the consonance of an interval with the others.
As long as all the temperaments are tested under the same conditions, that is, with ratios multiplied by
the same pitch and with the same weight function, the results are accurate.
Now we deepen a little bit the use of the weight function. Supposing the chromatic scale was played
by only one instrument, the weight function represents the harmonic spectrum and is the same for all the
ratios of the scale. Obviously, it makes sense to use only one weight function because, using functions
with different decay would induce different consonances in the intervals of the same chromatic scale.
Since our goal is to compare the consonance of all the intervals in the same circumstances, using more
than one weight function wouldn’t work. The function used was g(x) = e−(0.005x−0.005) , on figure 4.8.
y
1.0
0.8
0.6
0.4
0.2
0
5
10
15
20
25
30
x
Figure 4.8: Plot of the function g(x) = e−(0.005x−0.005)
It was important to use a weight function with slow decay because otherwise, all the measured
consonances would have very small values. The results obtained in this case were the following:
30
Unison
2m
2M
3m
3M
4P
4A
5P
6m
6M
7m
7M
Octave
1
0,465
0,489
0,439
0,436
0,546
0,425
0,608
0,405
0,378
0,378
0,361
0,727
0,438
0,500
0,416
0,389
0,727
0,401
0,439
0,373
0,381
0,727
0,406
0,397
0,375
0,372
0,727
0,402
0,377
0,371
0,364
0,727
Pythagorean Temperament
1
0,460
0,489
0,511
0,527
0,546
0,416
0,608
Just Temperament
1
0,476
0,474
0,449
0,527
0,478
0,443
0,518
1/4-Comma Temperament
1
0,468
0,473
0,454
0,463
0,498
0,416
0,546
1/6-Comma Temperament
1
0,455
0,475
0,440
0,442
0,519
0,411
0,573
Equal Temperament
Table 4.4: Consonance in all the temperaments with weight g(x)
Some values taken from this experience were not in accordance with what would be intuitively expected. In most of the temperaments the intervals of second were better than the ones of third. That is
totally unexpected since the third is an interval of great importance to the concept of harmony. In order to
improve the accuracy of the results it became clear we needed a weight function more realistic. Taking
advantage of the mathematical functions created in section 3.3.2, it was constructed an average of all
the recorded instruments’ spectra. The spectra used correspond to the central C in each instrument
because it is a reference note that all instruments can play in their comfortable range. The mean of all
the spectra was calculated, interpolated and drawn into the figure below:
Figure 4.9: Plot of the instruments’ average weight function
The method of obtaining the weight function above from a discrete list of points forming a harmonic
spectrum will be discussed later, in section 5.5.
The results of consonance using this weight function are expected to be much lower than the consonances given in Table 4.4 because the decay of the harmonics’ intensity is much steeper. Let’s take a
look at the results:
31
Unison
2m
2M
3m
3M
4P
4A
5P
6m
6M
7m
7M
Octave
1
0,0178
0,0106
0,0246
0,0311
0,1136
0,0521
0,2378
0,0165
0,0426
0,0176
0,0011
0,5961
0,0397
0,1221
0,0188
0,0029
0,5961
0,0079
0,0965
0,0118
0,0035
0,5961
0,0139
0,0750
0,0133
0,0025
0,5961
0,0227
0,0587
0,0153
0,0018
0,5961
Pythagorean Temperament
1
0,0005
0,0106
0,0617
0,0888
0,1136
0,0479
0,2378
Just Temperament
1
0,0562
0,0063
0,0266
0,0888
0,0898
0,0585
0,1894
1/4-Comma Temperament
1
0,0210
0,0075
0,0349
0,0647
0,0973
0,0479
0,2046
1/6-Comma Temperament
1
0,0044
0,0088
0,0310
0,0472
0,1045
0,0304
0,2193
Equal Temperament
Table 4.5: Consonance in all the temperaments with weight from Figure 4.9
Observing the tables of the results, one can notice some expected values for the temperaments. For
example, the Pythagorean and the equal temperament’s major thirds are the most dissonant of all. In
the just scale, the consonances for the intervals are higher than on all the other temperaments, except
on the minor second, augmented forth and major seven. These intervals are the ones considered to
sound worse in music, so we can conclude that the just scale is the one showing the greatest contrasts
between the consonances and dissonances.
As for the intervals in general, the fifths are all very consonant even though they are only pure in
the Pythagorean and the just scales. The octaves, fifths and fourths are the most consonant, by this
order, as it would be expected. The augmented fourths consonance is not as low as it might seem. It is
the base of the diminished chord used to represent tension in music, and therefore, usually connected
to dissonance. The regular use of this chord to obtain tension started with the establishment of the
equal temperament. Curiously the dissonance of this interval is more visible in the results of the equal
temperament.
As for the relation between the results in the different tables, there exists coherence between temperaments. That is, the comparison between intervals more consonant in one temperament than other
remains with the same relative results. The difference is between the intervals in the same temperament. Generally, the main difference is that the instruments’ average timbre brings up the consonances
of thirds and sixths. This is perfectly normal because the 5th harmonic of the series, which corresponds
to the interval of third between the harmonic and the fundamental, has a slight peak in the spectrum of
Figure 4.9.
Overall, the program works better to high frequencies but it outputs good values in a relative way.
That is, in a chromatic scale the values of interval consonances are realistic when compared to the
others in the scale and between differently tempered scales.
32
Chapter 5
Timbres and Consonance in the
Orchestra
The orchestra is a musical phenomenon which consists in a large ensemble of musicians playing instruments. The orchestra is divided in the following sections: strings, woodwinds, brass and percussion.
It wasn’t always like this, the orchestra formation evolved through time, starting as a simple instrumental group which didn’t include all the sections mentioned above. Around the eighteenth century, the
so called classical orchestra started taking some shape by having well structured string and woodwind
sections. The classical orchestra also included two horns, timpani and possibly two trumpets.
The romantic orchestra consisted in a grow of the classical orchestra, not only by enlarging the
existing sections, but also by adding some instruments as piccolo, English horn, bass clarinet in the
woodwind section. The percussion section was acknowledged, with common instruments as the cymbals, snare, bass drum, timpani, and in the brass section, trombones and tuba were also added. The
harp and some more uncommon percussions can appear in some characteristic repertoire [Adler, 2002].
Up to modern times, each of the orchestra sections increased a lot in size and this not only created an
enormous amount of sound but also provided more timbral effects to the composer. This organization of
the playing instruments in a music piece is called orchestration. It also consists on the study of how the
instruments sound better together, which sometimes may depend on simple things such as the register
of the notes played in the chord. One important feature to achieve is of course the consonance between
instruments. This matter will be discussed in section 5.5.
In order to study the consonance inside an orchestra, we must first analyse each instrument in
terms of its frequency spectrum because it defines the timbre, which distinguishes one instrument from
another. For that purpose we refer to the notes in the scientific pitch notation, in which a letter is used
to represent the note and a number to clarify its register. The number is initialized on a C and it is the
same for every note until the next C one octave higher. The numbers correspondent to each C pitches
are represented in the following figure [Young, 1939].
33
Figure 5.1: The different notes C in scientific pitch notation
We shall also check the different vibration forms of the instruments in each orchestra section and
describe analytically an approximation of its characteristic soundwaves.
The idea of creating an acoustic guide of the orchestra consists on studying each of its sections
and instruments in detail. For each section in the orchestra we analyse the vibrating motion of the
instruments and the harmonic spectrum.
5.1
Strings
In this section we analyse the sound produced by vibrating strings. Strings vibrate transversely, perpendicular to the string axis, and longitudinally, parallel to the same axis. Considering a string held at
both ends, it is easy to understand that if there are transversal vibrations, the string cannot increase its
size without stretching, which implies a longitudinal movement also. The amplitude of the longitudinal
vibrations is very small and its fundamental frequency is really high in pitch, so we shall disregard this
and analyse only transversal movement [Benson, 2007].
The transversal motion is represented by a variable y corresponding to the vertical displacement, x
representing the position along the string and t, time. Suppose we have a segment of a string displaced
as follows:
Figure 5.2: Representation of a string with an applied tension [Benson, 2007]
We consider x and ∆x, two positions measured along the horizontal axis. θ(x) is the angle of the
string, so tanθ(x) =
∂y
∂x .
Since the string is held at both ends, this means that there is a tension applied
34
in both sides of the string. We write T for the tension in newtons (kg m/s2 ) and ρ for the linear density of
the string, in kg/m.
In figure 5.2 are represented the vertical components caused by the applied tension. For small
angles, which is the case of transversal vibrations, tan θ(x) ' sin θ(x). Now we want to check the
vertical displacement:
T tan θ(x + ∆x) − T tan θ(x) = T (
Since ρ =
is a =
2
∂ y
∂t2
m
∆x
∂y(x + ∆x) ∂y
−
) = T ∆x
∂x
∂x
∂y(x+∆x)
∂x
−
∆x
∂y
∂x
' T ∆x
∂2y
.
∂x2
(5.1)
where m is the mass of the string, then m = ρ∆x. The acceleration in the vertical axis
and since F = ma where F is the force, then we have that
ρ∆x
∂2y
∂2y
∂2y
∂2y
' T ∆x 2 ⇐⇒ ρ 2 ' T 2 .
2
∂t
∂x
∂t
∂x
(5.2)
So we obtain the general equation to describe the motion of a vibrating string:
2
∂2y
2∂ y
=
c
,
∂t2
∂x2
where c =
q
(5.3)
T
ρ.
The general solution for this wave equation was found by d’Alembert, and is described in the following
theorem.
Theorem 3. The general solution of equation 5.3 is given by
y = f (x + ct) + g(x − ct).
(5.4)
Having boundary conditions y = 0 for x = 0 or x = l, where l is the length of the string, then the solutions
are of the form
y = f (x + ct) − f (−x + ct),
(5.5)
where f (λ) = f (λ + 2l), for any λ.
We only prove how to obtain solution 5.5 from 5.4.
Proof. Having the boundary condition x = 0, y = 0, we replace it in 5.4
0 = f (ct) + g(−ct),
(5.6)
for every t, so g(λ) = −f (−λ), for any value of λ. This gives
y = f (x + ct) − f (ct − x).
35
(5.7)
Replacing the other boundary condition x = l, y = 0 we get f (l + ct) = f (ct − l) for all t, so
f (λ) = f (λ + 2l),
(5.8)
for all values of λ.
Bernoulli shows an alternative representation of d’Alembert’s solution. Equation 5.8 implies that the
function f appearing in the solution is periodic with period 2l, therefore f has an expansion in a Fourier
series. Based on this fact, Bernoulli presents the following alternative solution, of each transversal
component depending on the nth harmonic:
y = 2C sin(
nπx
nπct
) sin(
+ φ).
l
l
(5.9)
Using this version of the solution it is possible to deduce Mersenne’s law of stretched strings:
n
fn =
2l
s
T
,
ρ
(5.10)
where fn is the frequency of the nth harmonic. This implies that the pitch of a string is lower when the
length is increased or when its linear density is bigger. The pitch is higher when the string experiences
a harder tension.
Spectral analysis of string instruments
The string instruments are constructed all with the same
purpose, amplyfying the sound of a vibrating string. Therefore, all the instruments have a wooden body
built in a way that makes the sound resonate more. And this implies that instruments provided to play
lower sounds must be bigger, because the waves are slower and their wavelength is bigger, requiring
more space to spread. All the string instruments analysed in this chapter have four strings, all fixed in
extremities at the same length, but with different linear masses and applied tensions. These instruments
are played by using a bow with bristles making a friction in the strings, causing the vibration. In the next
sections we consider a specific analysis for each of the following instruments: violin, viola and cello.
5.1.1
Violin
We shall now analyse some harmonic spectra of violin sounds so we can understand its different timbral
effects. Just to brighten up the way of function of this instrument, it has four strings, all positioned with
the same length, and ones lighter than others. The fundamental of each string is G3, D4, A4 and E5,
respectively. First of all we check the difference between a sound produced by a string pressed by a
finger and the natural sound of the string. The following pictures represent the open string G and the C
played by positioning a finger in that same string.
36
1.0
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
5
10
15
20
5
(a) G string
10
15
20
(b) C4
Figure 5.3: Harmonic spectra of the open string G and the note C positioned in the same string
It is clear that an open string has more sounding harmonics than a pressed one. Besides a little
q
n
T
muffling caused by the placement of the finger, according to section 5.1 we have that fn = 2L
µ.
Therefore the same note produced in an open string or in a tamped one has different harmonic spectra.
Let us consider for example the note A4 440 Hz produced by the open string, and the same note in the
D string, reached by shortening its size. The difference is that the first note is produced in a longer
and lighter string than the second one. Therefore, the wavelength of the harmonics of the open string
is always bigger than the second option, and so the vibration of the string is less restricted, allowing
harmonics to resonate more. We can assume by observing the figures in 5.3, that the harmonics
decrease in intensity the further they are from the fundamental. Exceptions happen in little peaks at the
harmonics of the fundamental octaves and in harmonics of other open strings. For example, consider
figure 5.4 with the harmonic spectrum of the open A string.
1.0
0.8
0.6
0.4
0.2
5
10
15
20
Figure 5.4: Harmonic spectrum of violin’s open string A
The third harmonic is really loud because the note is correspondent to the second harmonic of the
open E string. Therefore, playing this sound activates the E string to vibrate a little and contribute with
its harmonics.
In string instruments the harmonics can be induced by placing a finger lightly in a divided part of the
string. The second harmonic is given by placing the finger in the middle division of the string, and the
37
third by placing it in a third of the string. This is commonly applied until the 5th harmonic. We shall refer
to these harmonics as induced harmonics so we can differentiate them from the ones in a spectrum.
We now analyse the spectral differences between the open D string and its second induced harmonic.
1.0
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
5
10
15
20
(a) D string
5
10
15
20
(b) Second induced harmonic of the D string
Figure 5.5: Harmonic spectra of D open string and second harmonic
Both graphics appear to have the same shape, and peaks in similar places, which is easily explained
since both sounds are produced in the same string. But there is yet another observation we can make
of these graphics. Figure 5.5b contains the harmonics which correspond to the pair harmonics of 5.5a.
Therefore, the second graphic corresponds to a mix of the intensity of the pair harmonics in 5.5a and
the shape of its spectrum.
We could study the consonance of all the combinations of notes with the violin timbre. The program
created in Chapter 3 is ready for this, but this would be a really exhaustive analysis. Therefore, we shall
give some examples of consonance between the same and different instruments in several intervals in
section 5.5.
38
5.1.2
Viola
The viola was and is a polemic instrument, and its construction was disputed a lot over time. This
instrument has an open string tuned in C3 and the three lower strings of the violin. Although, the
resonance box of the viola is not big enough to resonate its lower string in the manner intended. But
increasing the size of the instrument enough to be favorable to this point, would turn it impossible to play
with the usual technique. For that reason, the viola timbre is more velvety than bright and loud. This
reflects in the harmonic spectrum, having a more uniform decay of the harmonics.
The harmonics of the open strings in the viola are similar to the violin ones with the exception that
the peaks are not as pronounced. So we comment only the spectrum of the C string, since it is the one
particularly different.
1.0
0.8
0.6
0.4
0.2
5
10
15
20
Figure 5.6: Harmonic spectrum of viola’s open string C
In figure 5.6 we see that the bigger peaks exist in the second and third harmonics, which are C3
and G3 respectively. The third harmonic is really pronounced since it causes the resonance of the
harmonics of the open G string. It is also curious to verify that the fundamental has a really low intensity
in the spectrum, similarly to the G string spectrum in the violin.
5.1.3
Cello
The cello has also four strings, C2, G2, D3 and A3, from the lower to the higher in pitch. Like we did for
the case of the violin, we check the harmonic spectra of the open strings of the cello, to understand the
different register timbres caused by each of the them.
39
1.0
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
5
10
15
20
5
(a) C string
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
10
15
20
15
20
(b) G string
1.0
5
10
15
20
5
(c) D string
10
(d) A string
Figure 5.7: Open strings in the cello
There are some curious observations related with the spectra in figure 5.7. All the strings have some
little peaks in strange odd harmonics. For example, for the lower string we notice that the first peaks
are in the harmonics corresponding to the octaves of the fundamental and then in the fifth harmonic.
Then, in the G string we find a peak in the 7th harmonic after the primary decay, which is an interval of
seven minor with the fundamental, reducing to an octave. This is definitely not a very consonant interval,
so this characteristic peaks are important to the definition of the timbre of the instrument. We can also
note that the A string has a second harmonic more resounding than the fundamental. However, it is a
characteristic uniquely of the open string since the C4 played by pressing a finger in that same string
has a spectrum with a peak in the fundamental.
Still referring to the A string, we notice some little peaks before the fundamental one, these are due
to some noise of the instrument during the recording. It is also the string with more resonant harmonics
in its spectrum, probably because the resonance box of the cello is in the ideal size for the vibration of a
sound in this range. Comparing the cello’s harmonic spectra of open strings to the violin ones we notice
that the size of the violin is more adequate for all the sounds it allows to produce.
40
5.2
Woodwinds
The wave equation of a wind instrument is expressed by the vibrating air particles inside the tube. To
calculate this we must have two new variables, air pressure and displacement. Air pressure is usually
at the ambient value ρ and when the air is compressed by the moving particles we obtain a pressure
P (x, t). The acoustic pressure is defined as p(x, t) = P (x, t) − ρ. The displacement is the change from
a rest position in the tube and is defined by ξ(x, t), the displacement of the air at position x and time t
[Henrique, 2011].
According to Hooke’s law,
p = −B
∂ξ
,
∂x
(5.11)
where B is the bulk modulus of the air. Since m = ρ∂Adx, where ∂A is the area of the surface where
∂p
the air passes, then F = −∂p∂A = ρ∂A∂xa. So we can define acceleration as a = − ρ1 ∂x
and so
∂p
∂2ξ
= −ρ 2 .
∂x
∂t
(5.12)
Using equations 5.11 and 5.12 we obtain the following equations
∂2ξ
1 ∂2ξ
=
∂x2
c2 ∂t2
with c =
q
B
ρ.
∂2p
1 ∂2p
=
,
∂x2
c2 ∂t2
(5.13)
These are the equations of displacement and acoustic pressure, respectively.
The boundary conditions are dependent on the tube being open or closed. First, we check the wave
propagation for open tubes, as the flute for example. We say that we have a pressure node where there’s
no fluctuation in the pressure, and an antinode when the change in the air pressure is maximum. We
also consider a displacement node a place where the air particles don’t suffer an unnatural velocity input,
and a displacement antinode occurs when the air particles move more rapidly. A displacement node
corresponds to a pressure antinode since the particles movement is constrained by the high acoustic
pressure, and vice versa.
In the open tube the pressure nodes are in the extremities of the tube, since they are at the ambient air pressure. Figure 5.8 represents the displacement nodes and antinodes in an open tube. The
different modes of the wave must be interpreted taking into account that this is only a representation of
longitudinal waves.
41
Figure 5.8: The first three modes of displacement nodes and antinodes for an open tube. N stands for
node [Henrique, 2011].
The relation between frequency f , and wavelength λ, is f =
v
λ,
where v is the velocity of the wave.
In figure 5.8 we check this relation for the fundamental and the first two harmonics.
In the case of a closed tube, like the clarinet, we have a pressure node in the only open extremity
and an antinode in the closed end. The displacement on closed tubes is represented in figure 5.9,
and as we can see, the possible modes for the displacement nodes and antinodes correspond to the
odd harmonics of the sound. For that reason, instruments which are closed tubes have louder odd
harmonics.
Figure 5.9: The first three modes of displacement nodes and antinodes for a closed tube [Henrique,
2011].
Conical tubes, as the oboe, behave as open tubes of the same length, as we can check through
figure 5.10.
42
Figure 5.10: Representation of displacement in a conical tube [Benson, 2007].
The modes of the stationary wave are caused by vibration of the air blown into the tube. When an
instrument has a coupled reed, then the vibration induced on the reed induces a mode oscillating at the
same frequency.
Spectral analysis of woodwind instruments
The woodwinds, in opposition to the strings, have spec-
tra with a more linear decay instead of harmonic peaks. In the next subsections we analyse the differentiations between harmonic spectra of instruments with different characteristics like open tube, single
reed, double reed, conical bore, etc...
5.2.1
Flute
As explained in section 5.2 the flute is a tube open on both sides. The sounds in different pitches are
affected by two different practices. Firstly, by varying the air pressure blown into the mouthpiece, the
tube may resonate at a harmonic and not at the fundamental. This is how the register of the notes in
the flute is controlled. The second aspect that allows the change of pitch is covering and uncovering
the holes existing in the tube. When covering all the tubes, we get the fundamental of the tube at his
original length. By uncovering some of the holes, it is like if the tube had the size correspondent to the
distance between the mouthpiece and the hole. Therefore, when all the holes are uncovered, the pitch
of the sound is higher.
In practical terms, the flute is considered to have three registers, one low, a middle one and the upper
register. This formalization takes into account the potentialities of the flute, for example, the low register
is known by being really rich in harmonics but week in aural impact. The upper register is the exact
opposite of the low one, few harmonics but a powerful sound. The middle register has an average of the
characteristics of the low and the upper registers.
The low register is considered from the low C4 to C]5, the middle one from D5 to G6 and the upper
is completed by the notes above G6. There is no obvious difference between the harmonic spectra of
the notes dividing the different registers. Nevertheless, the difference in the harmonic spectra can be
noticed by analysing the same note in different octaves. The following figure corresponds to the note C
in different octaves, starting in C4 and ending in C7.
43
1.0
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
5
10
15
20
5
10
(a) C4
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
10
20
(b) C5
1.0
5
15
15
2
(c) C6
4
6
8
(d) C7
Figure 5.11: Harmonic spectra of the notes C in the flute range
Of course, the lower C is the one with a more rich harmonic spectrum. The decay is pretty straightforward, and the peaks happen in the octaves of the fundamental, which isn’t rare at all. In the higher C’s
in 5.11 we notice that the harmonics are less, and less intense. The extreme case is the last harmonic
spectrum of C7, which contains almost uniquely the peak in the fundamental. This makes it a really thin
sound similar to a simple sound, that is, without harmonics.
5.2.2
Oboe
The oboe has a very characteristic timbre, the double reed and the conical format of the tube combine
to a resultant sound slightly nasal. The tube is made of wood and the sound is produced by blowing into
the reed. The reed vibrates, causing a vibration of the air in the tube. The oboe works in a similar way
to the flute. The length of the column of air vibrating changes by covering and uncovering the holes in
the instrument, through the use of metal keys. However, the oboe doesn’t change pitch by changing the
air pressure applied in the reed. That is performed only by the use of the register keys which force the
reed to vibrate the other harmonics besides the fundamental.
The oboe has three registers that differentiate the characteristic timbres of the notes in its range.
The lower register is from B[3 to E4, the middle one is from F4 to C6 and the higher from C]6 to A6.
The most common range is the middle one because it is formed by the sweeter notes the instrument
44
produces. The upper register sounds really thin and almost shrill and the lower one is not very powerful.
For the case of the oboe we analyse not only the note C in different registers but also some intermediate sounds, just to understand the timbre modification along the range.
1.0
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
5
10
15
20
5
10
(a) C4
1.0
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
5
15
20
(b) F4
10
15
20
5
10
(c) C5
15
(d) C6
1.0
0.8
0.6
0.4
0.2
2
4
6
8
10
12
14
(e) F6
Figure 5.12: Harmonic spectra of notes in the oboe range: C4, F4, C5, C6 and F6.
The conclusions we can draw from figure 5.12 is that the intensity of the harmonics decreases after
they reach a peak. That peak starts at the fifth harmonic in the lower C. However, in F4 the peak is
already in the forth harmonic, in C5 in the third harmonic and so on. Only in a really high range we
get the fundamental as the maximum of the spectrum. The oboe has, until now, the most progressive
spectra.
45
5.2.3
Clarinet
The clarinet is an instrument made of wood with a a cylindrical bore. The clarinet, contrary to the oboe,
doesn’t have a double reed but a single one. As seen before on section 5.2, the clarinet is a closed pipe
and some characteristics of this fact are noticeable, in comparison with the other woodwinds. Along this
section we are referring to the most usual clarinet, the one transposed in B[.
At first we define the registers of this instrument. These are really important since the clarinet has
a pretty long range and four very characteristic registers. The first is called chalumeau (from written
E3 to F4) and is very dark. The second one (F]4 to B[4) is the throat register which has a warm but
pale sound. The third register is clarino and goes from B4 to C6. This one is characterized by being
really bright, almost like a trumpet lookalike. To change from throat register to clarino the register key
is used. Since the clarinet doesn’t vibrate at even harmonics, the register key makes the reed triplicate
the frequency of vibration, therefore stimulating the third harmonic. This is an octave plus a fifth above
the fundamental E3, written, and this fact is in agreement with the first note of the clarino register being
B4. This change of register is called the "break" since the clarinettist has to move from almost no holes
covered to covering all of them.
1.0
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
5
10
15
20
(a) Sounding A[4
5
10
15
20
(b) Sounding A4
Figure 5.13: Harmonic spectra of the notes involved in the "break".
Figure 5.13 represents the harmonic spectra of B[4 and B4, sounding A[4 and A4. The difference
lies in the accentuation of the odd peaks in the first graph and the appearance of more even harmonics in
the second one. This happens because the vibration in the tube is already the one of the third harmonic,
then all the multiples of this one can vibrate, and not only the odd ones. Along the clarino register, the
harmonics tend to decay from the fundamental.
46
1.0
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
5
10
15
20
5
(a) Sounding C5
10
15
(b) Sounding C6
Figure 5.14: Harmonic spectra of notes in the clarino register.
In the representation of the sounding notes C5 and C6 above we can conclude also that along the
clarino register the decay of the harmonics softens up.
The fourth register (C]6 to C7) is called altissimo and is obtained by vibrating the fifth and seventh
harmonics, similar to the case of the clarino register vibrating the third harmonic. These high notes
characterize less the clarinet timbre, making it sound similar to high notes of a flute or an oboe. This
phenomenon is totally understandable because the "fingerprint" of the timbre is the correspondent harmonic spectrum and if the spectrum has almost no harmonics (like in figure 5.15 below), it is difficult to
distinguish one from another.
1.0
0.8
0.6
0.4
0.2
2
4
6
8
10
Figure 5.15: Clarinet high sound B[6.
5.2.4
Bassoon
The bassoon is the lowest instrument in the woodwinds section. The bassoon has a conical bore and
uses a double reed like the oboe. However, we will see that it has some imperfections and that also
reflects in the spectrum. The Bassoon is probably the woodwind instrument with the most complicated
construction. It is constituted by a tube that folds over itself and has a bell pointing upwards. It also has
a bocal which is a smaller crooked metal tube that holds the reed to the body.
The range of the bassoon goes from the low B[1 to D]5. This instrument has probably the most
47
contrasting mood-swings of timbre along its registers. From B[1 to E[2 the sound is very dark and
vibrant. The following range from E2 to G4 is obtained through the use of the register key, and has a
sweet and clear sound. Above G4 the timbre is very thin.
The extent of the whole pipe is used only for the lower notes and we can distinguish them perfectly
through the harmonic spectrum. It turns out that the bore of the bassoon is not a perfect cone because
it is truncated at the small end and replaced by the bocal. The oboe for example maintains the form of a
cone until reaching the reed. The fold of the tube is also really abrupt and that also disrupts the effect of
the conical bore. For that reason, when the whole length of the tube is used to produce a note we can
verify a certain inharmonicity in the higher overtones.1 In the figure below we can easily check that the
partials after the 8th one appear to be with a ratio more stretched than the harmonic.
1.0
0.8
0.6
0.4
0.2
5
10
15
20
Figure 5.16: Bassoon’s harmonic spectrum of the sound C2.
As for the notes in higher registers, the problem described before does not arise since the tube is not
used in its whole length. So, for example the note C3 has a spectrum totally harmonic (Figure 5.17).
1.0
0.8
0.6
0.4
0.2
5
10
15
20
Figure 5.17: Bassoon’s harmonic spectrum of C3.
The evolution of the spectra from the lower to the higher notes is similar to the one from the oboe.
The notes in the lower register have a peak in a higher overtone, and the higher the notes, the closer
the peak is to the fundamental.
1 An
explicit article on the acoustic particularities of the bassoon can be found in [Kopp, 2006].
48
5.3
Brass
The brass instruments can also be categorized as lip reed instruments. The propagation of air in the
tube works as in the woodwinds, however there are lots of differences between these two “species”. We
enumerate the most important, that we shall also deepen further:
• The lip reed;
• The mouthpiece, the bell and the bore of the tubing;
• Resonances, pedal tones and harmonics;
• Valves and slides.
Some of the characteristics we introduce right away and others will be detailed for each of the instruments. The brass instruments contain a mouthpiece, allowing the lips to vibrate in it. The tension
in the lips allows for a change in the vibration frequency, which induces a harmonic to vibrate along the
tube. Therefore, through this method the brass instruments can reproduce a harmonic sequence. That
would be if they were natural instruments, that is, if they didn’t have valves or slides. These additions to
the natural instruments enable brass players to play also chromatically. The valves introduce additional
tubing into the instrument, changing its length and thus the whole fundamental for the harmonic series.
By pressing the right combination of valves and vibrating the lips at a certain frequency, it is possible to
obtain a chromatic scale. The valves can be rotary or piston-like, which are different mechanisms for the
air to pass along the tubes added to the system. The trumpet, horn and tuba work with valves while the
trombone works with a slide. The slide makes the tube be more or less long, which also allows having
different fundamentals.
The lip reed makes the brass instruments work as a closed tube since the aperture between the
lips is small enough to cause reflection. But all the harmonics resonate in brass instruments, unlike the
clarinet. The ones with a conical bore reflect the waves in a similar way as the oboe does, making it
work like an open tube. The cylindrical pipes also don’t work as closed pipes due to the presence of a
mouthpiece, a flare and a bell. The mouthpiece produces the effect of bringing together the high odd
harmonics of the closed tube. This lowers the high pitch frequencies towards forming a harmonic series.
The bell, on the contrary, works as a resonator of high frequencies, bringing the lower frequencies also
to the harmonic series. This happens since the waves corresponding to low harmonics can’t follow the
curve of the bell due to their long wavelength. So, that selection of waves treats the beginning of the
bell as the end of the tube, so they reflect back. The higher harmonics can pass through, but the bell’s
distension makes the waves leave the pipe easier to the outside air. Therefore, in brass instruments’
harmonic spectra the intensity of high frequencies doesn’t decrease as much as in the woodwinds. The
bell also causes the effect of a projection of sound more directional, at least of the high frequencies.
The brass instruments having a small proportion of diameter/tubing length can’t play the fundamental
in a practical way. Therefore, in instruments like the trumpet and the horn, the lowest note of each
tubing length is the second harmonic. The tuba, however, can play the fundamental due to its large
49
bore. This fundamental which can’t be played in some of the instruments is called the pedal tone.
When the bell raises the lower resonances, none of them reaches the fundamental. The lowest of the
resonances is out of tune with the rest of the harmonic sequence therefore, it is not used. However, this
non-existent fundamental can be reproduced by vibrating the lips at its frequency because the higher
harmonics which constitute its series provide a make-believe resonance of this note. So, when that note
is reproduced, it has a fundamental with almost no intensity in the harmonic spectrum.
The sound produced by brass and woodwind instruments works theoretically in the same way. The
vibration consists in moments of pressure and relaxation of the air particles inside a tube. The differentiating elements were already mentioned above but the wave equation is substantially similar.
50
5.3.1
Trumpet
The trumpet has the highest register of the instruments in the brass family. It is constituted by a cylindrical
tube bent into a spiral and is played by using three piston valves. The mouthpiece of the trumpet is really
small due to its high pitch range. The trumpet exists transposed in various tones but the more common
one is in B[, and that’s the one we shall analyse through this chapter.
The range of the trumpet goes from the E3 to B[6, sounding, but some experienced players can
achieve higher pitches. We also have the problematic of the pedal tone, because some players can
execute C3 but it is so unstable that is mainly never used. The trumpet produces the harmonics by
increasing the frequency of the lips vibration. There are three piston valves corresponding to three
tubes in different sizes. One of them lowers the pitch by half a tone, the other by a whole tone, and
the third one by one and a half tones. Combinations of this valves allow for seven different sizes of the
air channel, therefore, seven different fundamentals for harmonic series. The lowest fundamental is a
diminished fifth below the fundamental of the trumpet with no pistons pressed, which in this case would
be E3. It is important to keep in mind that the referred fundamental of the trumpet is in fact the second
harmonic of a natural harmonic series.
The trumpet sound is very characteristic but it doesn’t have different timbre registers as the woodwinds, because there are no big influences like changes of register by the use of keys. Being a brass
instrument also makes the timbre more or less similar in the whole range.
1.0
0.8
0.6
0.4
0.2
5
10
15
20
Figure 5.18: Trumpet’s harmonic spectrum of the sound B[3.
Figure 5.18 corresponds to the harmonic spectrum of the trumpet’s B[3. We observe a peak in the
fifth harmonic followed by a progressive decrease of intensity. Note that for a high pitch instrument, we
have lots of high harmonics still intense in the spectrum. Like said before, brass instruments have more
acoustic impact than woodwinds and one of the reasons is due to having more resounding harmonics.
The peak of this spectrum is in the 5th harmonic but it changes from the notes with low pitches to the
higher ones. It goes back to all the other harmonics until it reaches the first one.
The next figure represents the harmonic spectrum of the highest note in the trumpet’s range. As we
can see, it is still richer in harmonics than the high register notes in woodwinds.
51
1.0
0.8
0.6
0.4
0.2
5
10
15
20
Figure 5.19: Trumpet’s harmonic spectrum of the sound B[5.
5.3.2
French Horn
The horn has suffered many changes over time. We got from the natural horn, which only provided one
harmonic series, to the modern horn which can play chromatically by the mean of valves. The modern
horn is usually in F but due to its impractical notes in the high range, it is coupled with and additional set
of a B[ horn. This is why it is also referred as a double horn. There are four rotary valves in the horn,
one to change the set from F to B[ and the other three to obtain chromatic notes.
The horn has a much wider range when compared to the trumpet and also with the other brass
instruments. A professional player would be able to play around four octaves, with the use of pedal
notes, but the common considered range is from the sounding F2 to the B[5. The horn can execute 16
harmonics in the series, contrary to the trumpet which can only reach 9. This is due to the fact of being
the longest brass instrument after the tuba and also because of its widely flaring bell. The bore of the
horn is essentially conical which also contributes for a rich harmonic spectrum. It works like the conical
tubing of the oboe and that reflects also in the timbre which can be more discrete than the ones of the
trumpet and the trombone. Of course it is not a coincidence that the horn and the tuba are the brass
instruments with more timbral differences between registers, since both have a conical bore.
1.0
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
5
10
15
20
(a) F2
5
10
(b) C3
Figure 5.20: Horn’s harmonic spectra in different registers.
52
15
20
The harmonic spectra above represent the notes F2 and C3 and we can see that the lower sound has
a more complex spectrum. In the graphic 5.20b we observe that the increase and decrease of intensity
could be modelled by quadratic functions. For example a piecewise function with a negative coefficient
until the 4th harmonic and with positive coefficient for the following domain.
The spectrum in figure 5.20a isn’t so simple to define mathematically, for example, there are at least
three peaks and the harmonics in between decrease and increase to the next harmonic peak. Also, the
little interference in the spectrum that appears before the first harmonic is the resonance caused by the
bell which doesn’t belong to the spectrum.
5.3.3
Trombone
The trombone is the second lowest instrument of the brass family. It is constituted by a cylindrical tubing
but the bell and the mouthpiece are responsible for building the harmonic series. Since the harmonic
series of the cylindrical brass instruments is artificially made by the means mentioned previously, they
don’t have as many playable harmonics as the conical instruments. Anyway, trombonists can still reproduce nine harmonics for each fundamental. The fundamental in this case is also considered to be
the second harmonic despite being possible to play the real fundamental, the pedal tone. However, the
pedal notes are not playable for all the positions of the trombone so the series is considered only from
the second harmonic on.
The trombone has seven positions, each lowering the fundamental for half a tone. The first position
starts in a B[ and the seventh in a E. The following figure represents the harmonic series for each
position, but take into account that the lower note written per position is the pedal tone.
Figure 5.21: Representation of the positions possible in the trombone and the respective harmonics
[Adler, 2002].
The range of the trombone is from E3 to D5, not including the pedal tones. By looking to the harmonic
spectrum of different notes of the trombone we get the feeling that the timbres along its range are all very
similar. That is not incorrect because the different timbres reproduced by trombone are more related to
the type of attack given to the sound. The main difference possible to distinguish through the harmonic
spectrum is between the pedal tones and the other ones. Figure 5.22 represents some notes along the
trombone range.
53
1.0
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
5
10
15
20
25
30
35
5
(a) C2
10
15
20
(b) C3
1.0
0.8
0.6
0.4
0.2
5
10
15
20
(c) C4
Figure 5.22: Harmonic spectra of a trombone playing a C in three different registers.
The first one is a pedal tone and we can differentiate it by the intercalated bigger and lower intensities
of the harmonics that characterize the decrease of the higher harmonics. It is also possible to notice
a lag between the overtones and the multiples of the fundamental. This is related with the way the
harmonic series of the trombone is created. The compensation of the mouthpiece and the bell allows
for a series with all the harmonics and not only the odd ones, but this is constructed artificially so it is
likely that the higher harmonics are a little out of tune. In the trumpet’s spectra we find the same issue
but since there are less resounding harmonics, it is not so evident.
The other two graphics have a spectrum similar to the brass instruments analysed in the previous
sections.
5.3.4
Tuba
The tuba is the lowest and longest brass instrument. It has a conical bore as mentioned previously and a
really wide bell. The tuba is usually played by the use of four rotary valves. Since the tuba plays in a very
low register the three valves are not enough to lower the fundamental by a perfect fourth. The tubing
necessary to lower the fundamental by four half-tones requires the use of only three valves, like the
trumpet. Nevertheless, getting even lower fundamentals implies the use of a longer tube which cannot
be created by the combination of the other three.
54
The range of the tuba goes from D1 to G4, making it a versatile instrument. The timbre in the lower
notes is really heavy but it softens up when going to higher pitches. The following figures show two
harmonic spectra in different registers of the tuba.
1.0
1.0
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
5
10
15
20
25
30
5
(a) F1
10
15
20
(b) C3
Figure 5.23: Harmonic spectra of an F tuba.
The note F1 has probably the most stable harmonic spectrum of the lower notes analysed. There
are not peaks in different parts of the spectrum and there is a wide range of harmonics. The decrease
is really slow when it reaches the 15th harmonic and there is only one peak in the 6th harmonic. Unlike
the lower notes of the trombone, the tuba maintains the harmonicity of the higher overtones. This is
probably due to the conical diameter since it reduces the effect of the closed tube issue. Similarly to the
oboe, the even harmonics are also present and so the compensation given by the mouthpiece and the
bell allows the better tuning of the series.
As for the second graphic 5.23b is a classic spectrum for the high range of a brass instrument. A
quadratic decrease starting in the fundamental with ten harmonics with a considerable amplitude.
55
5.4
Percussion
In this chapter we shall analyse the most common percussion instrument present in orchestral pieces,
the kettledrum. This is a tuned version of a drum, in which the tension of the membrane can be regulated
to allow sounds with different fundamental pitches. The wave equation for this cases is constructed more
or less in the same way as 5.3, but with three dimensions instead. The vibrations are transversal to the
membrane, and as we’ll see later, we have node lines and not points causing phase and anti-phase of
the wave in each of the sides.
The tension T in the membrane is uniform and the mass density ρ is now measured in kg/m2 ,
because we are considering area units. We picture a rectangle in the middle of a circular membrane
to analyse the tension in the various axis, applied to the rectangle. To better understand the three
dimensions wave equation, we represent the vertical and horizontal axis and components of the tension
in diagram 5.24.
Figure 5.24: The vertical and horizontal tensions in the membrane.
Taking into account 5.1, we have that the difference in vertical components of the force (in the z axis)
caused by the tension on the left and right sides is
(T ∆y)(∆x
∂2z
).
∂x2
(5.14)
Now considering the tension from the front to the back of the membrane, we get
(T ∆x)(∆y
∂2z
).
∂y 2
(5.15)
So the total vertical force is
T ∆x∆y(
∂2z
∂2z
+ 2 ).
2
∂x
∂y
(5.16)
Since the mass of the rectangle is ρ∆x∆y, by Newton’s law we have
T ∆x∆y(
∂2z
∂2z
∂2z
∂2z
∂2z
∂2z
∂2z
∂2z
∂2z
+ 2 ) ' (ρ∆x∆y) 2 ⇐⇒ T ( 2 + 2 ) = ρ 2 ⇐⇒ c2 ( 2 + 2 ) = 2 , (5.17)
2
∂x
∂y
∂t
∂x
∂y
∂t
∂x
∂y
∂t
56
where c =
q
T
ρ
as usual.
We now convert this result to polar coordinates, taking into account the following trigonometric relations:
x = t cos θ, y = r sin θ, r =
First, we calculate
∂2z
∂r 2
and
p
x2 + y 2 .
(5.18)
∂2z
∂θ 2 .
∂z ∂x ∂z ∂y
∂z
=
+
∂r
∂x ∂r
∂y ∂r
∂ ∂z
∂2z
∂ ∂z
= cos θ ( ) + sin θ ( ) =
∂r2
∂r ∂x
∂r ∂y
∂2z
∂2z
∂2z
∂2z
= cos θ( 2 cos θ +
sin θ) + sin θ( 2 sin θ +
cos θ) =
∂x
∂x∂y
∂y
∂y∂x
∂2z
∂2z
∂2z
= cos2 θ( 2 ) + 2 cos θ sin θ(
) + sin2 θ( 2 )
∂x
∂x∂y
∂y
∂z
∂z
∂z
= −r sin θ
+ r cos θ
∂θ
∂x
∂y
∂2z
∂ ∂z
∂z
∂ ∂z
∂z
= −r sin θ ( ) − r cos θ
+ r cos θ ( ) − r sin θ
=
∂θ2
∂θ ∂x
∂x
∂θ ∂y
∂y
∂2z
∂2z
∂z
∂2z
∂2z
∂z
= r2 sin2 θ 2 − r2 sin θ cos θ
− r cos θ
+ r2 cos2 θ 2 − r2 sin θ cos θ
− r sin θ
=
∂x
∂x∂y
∂x
∂y
∂x∂y
∂y
∂2z
∂z
∂z
∂2z
∂2z
= r2 (sin2 θ 2 + cos2 θ 2 ) − 2r2 sin θ cos θ
− r(cos θ
+ sin θ )
∂x
∂y
∂x∂y
∂x
∂y
Using the second derivatives calculated above we have that
∂2z
1 ∂2z
∂2z
∂2z
1
∂z
∂z
+
=
+
− (cos θ
+ sin θ ) =
2
2
2
2
2
∂r
r ∂θ
∂x
∂y
r
∂x
∂y
∂2z
∂2z
1 ∂z
=
+ 2−
,
∂x2
∂y
r ∂r
(5.19)
(5.20)
and so,
2
1 ∂2z
1 ∂z
∂2z
∂2z
∂2z
1 ∂2z
1 ∂z
∂2z
2 ∂ z
+
+
=
+
=⇒
=
c
(
+
+
).
2
2
2
2
2
2
2
2
2
∂r
r ∂θ
r ∂r
∂x
∂y
∂t
∂r
r ∂θ
r ∂r
(5.21)
The solution to this wave equation is
z = Jn (
ωr
) sin(ωt + φ) sin(nθ + ψ).
c
(5.22)
Jn is a Bessel function which is the canonical solution for Bessel’s equation,
x2
∂y
∂2y
+x
+ (x2 − α2 )y = 0.
2
∂x
∂x
57
(5.23)
This equation appears while solving wave equations with polar coordinates. The function is defined
for n ∈ Z but we shall not deepen this matter much. So it is enough to assume the function’s values and
take into consideration how it works, by checking its plot in 5.25.
1.0
0.8
J_0HxL
0.6
0.4
J_1HxL
0.2
J_2HxL
10
20
30
J_3HxL
40
-0.2
-0.4
Figure 5.25: Representation of the Bessel functions J0 (x), J1 (x), J2 (x) and J3 (x).
The only boundary condition for 5.22 is that no transversal vibrations occur in the limit of the membrane. So considering a radius b for the membrane we have that z = 0 when r = b, ∀t,θ . Therefore,
Jn ( wb
c ) = 0 and since Jn has an infinite discrete number of zeros depending on the argument, then ω
can take an infinite discrete set of values.
Table 5.1: Values of zeros for Bessel functions [Benson, 2007].
Table 5.1 gives the values of the kth zeros of Jn for n = 0, ..., 7. We consider jn,k to be the kth zero
of Jn . So we get that the frequency fn,k of a vibrational mode is
Jn (jn,k ) = 0 =⇒
cjn,k
2πb
since
ωb
cjn,k
= jn,k ⇐⇒ cjn,k = ωb ⇐⇒ cjn,k = 2πfn,k ⇐⇒
= fn,k .
c
2πb
cj0,1
2πb
since it is the solution for the
jn,k
j0,1 f0 ,
and the frequencies from all
We consider that the fundamental frequency of the membrane is f0 =
smallest value of a zero of Bessel functions. So we have that fn,k =
the vibrational modes depend on the values of Bessel functions’ zeros.
58
(5.24)
Figure 5.26: Stationary points formed by the solutions of equation 5.21 [Benson, 2007].
The solutions of equation 5.22 give the stationary lines represented in figure 5.26, and in each side
of the line the vibrations are in opposing phases. This explains why the fundamental is not heard as
much as f1,1 , because the air in the drum suffers expansion and compression which is constrained in
the case of f0 . f1,1 is called the nominal frequency. Also, f2,1 , f3,1 and f4,1 have a frequency ratio with
respect to f1,1 close to 32 ,
4
2
and 52 , respectively. According to the harmonic spectrum, this proves that f0
was supposed to be the fundamental, although it is nearly not heard.
So we realise that in the case of the membranes the modes don’t have a clear harmonic structure
since the harmonics of a note don’t relate by being a multiplication of a natural number by the fundamental. This explains why it is hard to verify the tuning of a kettledrum, probably the best way is to dampen
most of the harmonics.
Unfortunately, a real kettledrum is somehow difficult to load into a recording studio and it was impossible to record its sound. However, the snare drum is smaller and more portable and was, therefore,
recorded. This drum is unpitched but it is still a membrane and so it has resonant frequencies. The
harmonic spectrum is hopeless because the snare drum is not only inharmonic, like the kettledrum, but
a part of its percussion slope is the white noise characteristic. We can see this by checking that there is
no clear periodicity in the form of the soundwave of a note played in this instrument (Figure 5.27).
59
0.04
0.02
100
200
300
400
500
600
700
-0.02
-0.04
Figure 5.27: Harmonic spectrum of a snare drum.
5.5
Consonance analysis of orchestral excerpts
This section includes two very small excerpts of music composed by Wagner and Beethoven. The first
excerpt is the first chord from the beginning of the Prelude of the opera Tristan und Isolde and the
second one the first interval of Beethoven’s 9th symphony. After this orchestral cases the question of
consonance will be analysed between two instruments, the oboe and the clarinet. This last subsection
aims to show the ability of the program to solve some specific issues related with orchestration.
However, it is necessary to make some adjustments to the timbre representation in order to turn
them into reliable weight functions. This corrections are performed immediately before analysing the
orchestral excerpts.
5.5.1
Weight function of a harmonic spectrum
Having calculated the harmonic spectrum of a function in section 3.3.2, we must turn it into a continuous
weight function so we can calculate the consonance between instruments with different timbres. We
could simply interpolate the list of points obtained from the harmonic spectrum but that would lead
to a huge problem. Suppose we have a peak of the spectrum in a point slightly deviated from the
correspondent harmonic order. Since the peak decreases steeply, the weight attributed to a harmonic
could be close to zero. That would be totally unrealistic because the harmonic must represent the weight
of the peak. For this reason we selected the maximum point corresponding to each harmonic peak. The
interpolation of these values gives a final weight function for a timbre. The figures below show the
interpolation of a spectrum that shall be used in the following section.
60
1.0
0.8
0.6
0.4
0.2
5
10
15
20
(a) Spectrum
1.0
0.8
0.6
0.4
0.2
10
15
20
(b) Weight Function
Figure 5.28: Harmonic spectrum of violin’s A3 and respective interpolation
To the final weight function we still need to perform a final adjustment. The “missing fundamental”
phenomenon claims that if we listen to a sound with a spectrum with all the harmonics except the
fundamental, we still perceive the pitch of the fundamental. This is similar to the case of the pedal tone
for brass instruments. This influences the notion of consonance because, even if the fundamental is not
intense in the spectrum, psycho acoustically it is the most intense of all. For that reason we induce a
fundamental of intensity 1 to every weight function. This allows the spectrum to be closer to what we
listen and not only what is reproduced by the instrument [Santurette, 2011].
5.5.2
Wagner’s Tristan chord
The first chord of the opera Tristan und Isolde is very well known by musicians and others who are
familiar with the piece. In terms of musical analysis it is a chord difficult to identify. For that reason some
conjectures started to point the chord as a timbre environment, more than a normal identifiable harmony.
For that reason it is a curious case to study the matter of consonance. The instruments involved in this
are two bassoons, two clarinets, two oboes, one English horn and the celli (Figure 5.29).
61
Figure 5.29: Music score of the instruments playing the Tristan chord [Wagner, 1912].
The notes played are F3, B3, D]4 and G]4 and we shall analyse some of the most curious consonances and dissonances between them. The English horn’s timbre was replaced by the oboe’s in the
same note since it was impossible to record the English horn. The following table shows the approximate
consonances of the combinations between notes.
obG]4
obD]4
clB3
clF 3
basB3
basF 3
celD]4
obG]4
1
-
obD]4
0, 0222
1
-
clB3
0, 0652
0, 0128
1
-
clF 3
0, 0709
0, 0750
0, 1393
1
-
basB3
0, 0060
0, 0012
1
0, 0140
1
-
basF 3
0, 0109
0, 0082
0, 0176
1
0, 0017
1
-
celD]4
0, 0942
1
0, 0461
0, 0532
0, 0044
0, 0067
1
Table 5.2: Consonances in the notes of the Tristan chord
ob-oboes/ cl-clarinets/ bas-bassoons/ cel-celli
All the unisons have consonance 1 as it would be expected. Generally, the intervals between the
clarinets and other instruments are better than the same intervals when using bassoons. This is related
with the spectrum of the bassoon being very poor (Figure 5.30), so there are not many partials in
common.
62
1.0
0.8
0.6
0.4
0.2
5
10
15
20
Figure 5.30: The bassoon spectrum of B3
The perfect fourth between D]4 and G]4 is better between the oboe and the cello than between two
oboes. This is a curious fact because the oboe is rarely an instrument adaptable with the partials of the
other instruments. The clarinet, on the contrary, adapts more or less due to the odd peaks. That is why
the intervals between a clarinet and other instrument are usually more consonant. Section 5.5.4 is an
example of this particularity as well as the interval F3-B3 in this piece. The most consonant version of
this interval is between two clarinets and the less consonant with two bassoons. The other combinations
between clarinet and bassoon have an intermediate consonance.
What we can conclude is that the fusion between instruments with less harmonics, like the bassoon
and the oboe, and with more harmonics, like the cello and the clarinet, creates a timbre sounding almost
as a fusion of various timbres. The consonances are all really low due to the few and weak harmonics.
But in general the effect is to cross intervals more consonant like the third and perfect fourth with an
augmented fourth in the lower notes. This creates the effect of a consonance supported by a dissonant
bass.
63
5.5.3
Beethoven’s fifths in the 9th symphony
Now we restrict the universe of chords and analyse only the same interval in different instruments. This
is the case of the fifth A-E introducing Beethoven’s 9th symphony.
Figure 5.31: Music score of the symphony opening [Beethoven, 1826].
Unlike the example seen of Wagner’s Prelude, this initial interval is a representation of consonance.
The interest in this excerpt resides in the study of the different possible consonances of the fifth. For
example the consonance of the fifth between the two horns is 0.2907 which is better than the same
calculation for the violins, 0.1349. Also, the consonance of the fifth in the horn and the violins, is
better when the horn does the low sound A3 and the E4 is played by the violins. The horn is an
instrument usually taken to support harmony, and this justifies the fact that it improves the consonance
by playing the bass. The most interesting interval is between the A2 in the celli and the E4 in the Horn.
Both instruments have rich spectra, which allows a bigger consonance, but this case is special. The
fundamental frequency of E4 corresponds exactly to the frequency of the third harmonic in the celli’s
A2. The most intense harmonic in the celli spectrum is the third one, as it can be seen in Figure 5.32.
For that reason the consonance of this interval is 0.9344, which is in fact very high. This means that
the registers of the fifths are placed in a way that turns it almost into the most consonant interval of fifth
possible.
64
1.0
0.8
0.6
0.4
0.2
5
10
15
20
Figure 5.32: Spectrum of the celli playing the note A2
5.5.4
Clarinet and oboe, the most consonant dissonance
The case of consonance between the oboe and the clarinet is peculiar because the characteristics of
each timbre are totally distinct. A composer always has a good reason to use an instrument instead of
another. For the case of the clarinet it could be for a warm accompaniment or soft melody. The oboe is
more pungent when compared to the clarinet.
The following analysis is only a small part of what can be obtained with the consonance program. The
following discussion intends to answer the following question: "How can I create the worst second minor
between the oboe and the clarinet?". We have observed examples of consonance in the excerpts above
so, in this case we are trying to obtain the opposite. Note that the same question could be applied to any
combination of instruments and intervals, and this means we can find the worst dissonances but also
the best consonances. For this specific case we looked at the consonance of the minor second between
C4 and C]4. The following table displays the results of this interval played by oboes and clarinets in all
possible combinations.
obC4 + obC]4
obC4 + clC]4
clC4 + obC]4
clC4 + clC]4
0, 0715
0, 0928
0, 0983
0, 0879
Table 5.3: Consonances of a minor second in the clarinet and the oboe
This results allow curious conclusions like, for example, when the interval is played by a clarinet and
an oboe, the most consonant option is with the low note in the clarinet. This fact is perfectly acceptable
since the clarinet, having more harmonics in these low notes, is probable to have more harmonics in
common with the higher oboe sound. The second and last conclusion is that two oboes or two clarinets
playing this interval sound more dissonant than one clarinet and one oboe. We can therefore say that
this dissonance is reinforced by the clash of two equal timbres.
65
Chapter 6
Conclusions
This chapter serves essentially to sum up the major conclusions drawn along the thesis. This will allow
us to comment how they all fit in a whole perspective.
The study of temperaments in Chapter 4 presented extensive results of consonance. However, the
fundamental observations are the relation of consonances between temperaments and between the intervals in each temperament. At first we concluded that, independently of the timbre, if an interval is
more consonant in a temperament than another, it remains more consonant. The fluctuation of consonance appears only in the relation between different intervals in the same scale. For example, the
intervals of third are more consonant when a realistic timbre is considered to analyse all the intervals in
a scale, as seen before.
Practical applications of the results in Chapter 4 consist in convince some sceptics that the consonances in equal temperament are not in fact the best. The following quote by Robert Rich explains his
opinion on the use of temperaments: “(Equal temperament) sounds dead and lifeless to me. As soon as
I began working microtonally, I felt like i moved from black & white into color. I found that certain combinations of intervals moved me in a deep physical way”. This perspective shows that the temperaments
allow for a whole new universe of possibilities to show human emotion through music.
As for Chapter 5, differs from the previous one specially in the context of its applications. The idea
of a program outputting which timbre options are better for a specific effect can be an important tool for
a composer. Of course that this is analysed only in terms of consonance, but that already allows the
creation of different timbre environments. For example, if one wants to create a dramatic effect of great
tension, it is possible to see which instruments can sound more dissonant together and contribute to this
atmosphere.
The analysis of the spectrum for each note of an instrument is already of great importance to orchestration. Lets consider a typical example used in music composition: the use of an instrument with
many intense harmonics to enrich the sound of other instrument. The trumpet playing in a high register
emits a powerful sound but very thin and that is why the clarinet is sometimes used in unison. Thus,
one obtains a whole sound characterized by the metallic timbre of the trumpet but with a rich base of
harmonics. A similar observation was made in Chapter 5, saying that the instruments doing the bass of
66
an interval or chord are usually the ones with richer spectra. This builds up a solid base of harmonics
for melodies to develop in higher registers.
The two applications of the program serve two different ambitions. One is to show that the ancient
knowledge in temperaments was used to create effects nowadays lost. The other is to prove that a
scientific approach to the notion of timbre and consonance can assist in many ways to the composition
of music.
6.1
Future Work
There are many ways the work developed in this thesis can be continued, specially in the subject of
composition and orchestration. For example:
• How can we adapt the consonance program to a chord?
• Can we justify the position of a certain instrument in the chord by the effect in consonance?
These are the subjects that could be developed in consonance. Note that there are numerous combinations of every chord in every instrument. Thus, it wouldn’t make any sense to do an exhaustive work of
filling tables with all the values of consonance. A good way to use all this material would be to develop a
software that would give a result according to the user’s choices. Options of timbres and intervals could
be chosen and the output could include the consonance of the interval in different temperaments and
harmonic spectra of the instruments, for example.
Before reaching this point, there is a matter that can still be improved in the consonance program.
The sound the instrument reproduces might be slightly different of what our brain perceives. For that
reason we considered the compensation of the “missing fundamental” in Section 5.5. Although the
research in psychoacoustics is not in the scope of this thesis, it can improve the program of consonance
by being even more realistic.
67
68
Bibliography
S. Adler. The study of orchestration. Norton, 3rd edition, 2002.
P. Asselin. Musique et Temperament. Jobert, 2000.
L. Beethoven. Symphony No.9, Op.125 - first edition. Mainz, 1826.
L. V. Beethoven. Symphonies Nos. 5, 6 and 7 in Full Score. Dover Music Scores, 1989.
D. J. Benson. Music: A Mathematical Offering. Cambridge University Press, 2007.
A. Denis. Ap music theory course, August 2011. URL https://sites.google.com/a/friscoisd.org/
ap-music-theory-whs/introduction.
R. W. Duffin. How equal temperament ruined harmony (and why you should care). W.W.Norton, 2006.
H. Helmholtz. On the Sensations of Tone. Dover Publications, fourth edition, 1954.
L. L. Henrique. Acústica Musical. Fundação Calouste Gulbenkian, 4th edition, 2011.
J. B. Kopp. The not-quite-harmonic overblowing of the bassoon, 2006. URL http://www.koppreeds.
com/harmonic.html#section5.
R. Plomp and W. J. M. Levelt. Tonal consonance and critical bandwidth. J. Acoust. Soc. Amer., 38,
1965.
S. Santurette. Neural coding and perception of pitch in the normal and impaired human auditory system.
PhD thesis, Technical University of Denmark, 2011.
C. E. Shannon. Communications in the presence of noise. Proc. IRE, 37:10–21, January 1949.
J. O. Smith and J. S. Abel. The bark and erb bilinear transforms. IEEE Transactions on Speech and
Audio Processing, December 1999.
B. H. Suits. Physics of music - notes, 1998-2013. URL http://www.phy.mtu.edu/~suits/notefreqs.
html.
R. Wagner. Tristan und Isolde. C.F. Peters, 1912.
P. D. Welch. The use of fast fourier transform for the estimation of power spectra: A method based
on time averaging over short, modified periodograms. IEEE Transactions on Audio Electroacoustics,
AU-15:70–73, 1967.
69
R. W. Young. Terminology for logarithmic frequency units. The Journal of the Acoustical Society of
America, 11:134, 1939.
70
Chapter 7
Appendix
The following pages include the most important routines written in Mathematica in order to create the
consonance program.
71
Consonance in
Mathematics and Music
1. Programas e testes de frequências fundamentais/Identificação de
harmónicos e respectivos intervalos/Escala cromática em módulo 12
H*Recebe uma frequência inicial e o número de harmónicos
a calcular para essa frequência e devolve uma lista com
elementos da seguinte forma 8fracção do intervalo da parcial,
frequência do harmónico reduzido à primeira 8ª<.*L
CalcFreq = Function@8x, k<,
Module@8i, j, oit, res, freq, frac<,
res = 8<;
i = 1;
j = x * i;
H*A frequência x é multiplicada pelo natural i de forma a calcular o i-ésimo
harmónico. Na primeira iteração do ciclo while multiplica-se x por i=1.*L
oit = 0; H*oit indica a redução de oitavas que é necessário fazer para que
a frequência de certo harmónico esteja entre x e 2x, a primeira oitava.*L
While@i <= k, H*Como queremos apenas calcular k harmónicos
queremos que a frequência x seja multiplicada por números
naturais começando em 1 e terminando em k, inclusive.*L
While@! Hx <= Hj  2 ^ oitL < Hx * 2LL, H*Enquanto a guarda for verdadeira,
a frequência j=xi não está na 1ª oitava pelo que é necessário aumentar
o número de oitavas pelas quais se divide a frequência j*L
oit = oit + 1D; H*Aumento do número de oitavas pelas
quais se divide a frequência j.*L
freq = N@j  2 ^ oitD; H*Frequência do i-ésimo harmónico já na 1ª oitava.*L
frac = i  2 ^ oit; H*Fracção do intervalo
entre a frequência x e a frequência do i-ésimo harmónico.*L
res = Append@res, 8frac, freq<D; H*Cria a lista com as
frequências e fracções dos harmónicos.*L
i = i + 1; H*Volta a fazer o ciclo mas agora com i=i+1.*L
j = x * iD;
resDD;
H*Devolve a lista final das frequências e fracções dos harmónicos.*L
72
Printed by Mathematica for Students
2
Consonance in Music and Mathematics.nb
H*Recebe o número de harmónicos duma frequência que
se quer procurar e devolve uma lista com elementos da forma
8n-ésimo harmónico,fracção do intervalo do harmónico n com o
1º harmónico. Este programa funciona como o programa CalcFreq,
com a diferença que recebe apenas o número de harmónicos a calcular e
trabalha apenas com os intervalos entre notas, representados por fracções.*L
CalcFracHarm = FunctionAx,
ModuleA8i, oit, res, frac<,
res = 8<;
i = 1;
oit = 0;
WhileAi <= x,
H*Efectua o ciclo while até ao x-ésimo harmónico, inclusive.*L
While@! H1 <= Hi  2 ^ oitL < 2L, H*Verifica se i é um intervalo
relativamente à fundamental na primeira oitava e caso não esteja,
divide por 2 até que i esteja entre 1 e 2, a 1ª oitava.*L
oit = oit + 1D;
frac = i  2 ^ oit; H*frac devolve o intervalo relativamente
À fundamental do i-ésimo harmónico já na 1ª oitava.*L
res = Append@res, 8i, frac<D; H*Cria uma lista com os índices dos
harmónicos e o seu intervalo relativamente à fundamental.*L
i = i + 1E;
resEE;
CalcFreq@440, 20D H*Teste para o Lá 440 Hz com cálculo de 20 harmónicos.*L
CalcFracHarm@30D H*Teste para o cálculo de 30 harmónicos.*L
H*Esta função só funciona até ao 30º harmónico. Recebe n correspondente ao nésimo harmónico e devolve a nota na escala cromática mod12.*L
Cromatica = Function@x,
Module@8i, oit<,
oit = 0;
If@IntegerQ@xD && x > 0 && x < 31,
While@! H0 <= x  2 ^ oit < 1L, H*Procura quantas oitavas é preciso
dividir para que o harmónico seja uma fracção menor que 1.*L
oit = oit + 1D;
i = Hx - 2 ^ Hoit - 1LL * 2 ^ H5 - oitL;
H*Coloca em crongruências de módulo 16 a nota do harmónico recebido.*L
Which@i <= 5, i, H*Este which passa para congruências em módulo 12,
as congruências módulo 16 calculadas anteriormente.*L
i == 6 ÈÈ i == 7, i = 6,
i == 8, i = 7,
i == 9 ÈÈ i == 10, i = 8,
i == 11, i = 9,
i == 12 ÈÈ i == 13, i = 10,
i == 14 ÈÈ i == 15, i = 11DDDD;
73
Printed by Mathematica for Students
Consonance in Music and Mathematics.nb
H*Recebe o número das parciais e devolve a
sua nota correspondente na escala cromática mod12.*L
EscalaCromatica = Function@x,
Module@8j<,
If@IntegerQ@xD && x > 0,
j = Table@i, 8i, x<DD;
Map@Cromatica, jDDD;
H*Aplica o programa Cromatica a todos os harmónicos até ao x-ésimo harmónico,
ou seja, devolve todos os harmónicos até x em mód12 na escala
cromática. Exemplo: 0 corresponde à fundamental, 7 à dominante, etc...*L
Cromatica@10D H*Teste para o 10º harmónico que corresponde
à nota 4 na escala cromática, ou seja, a uma 3ª maior.*L
EscalaCromatica@30D H*Teste para verificar quais são as notas na escala
cromática dos primeiros 30 harmónicos cuja frequência fundamental é 0mód12.*L
a = CalcFreq@440, 20D H*Teste para o Lá 440 Hz com 20 parciais.*L
b = CalcFreq@660, 20D H*Teste para o intervalo de 5ª pura com o Lá 440 Hz,
o Mi a 660 Hz também com 20 parciais.*L
2. Programa para computar a consonância dum intervalo
Primeiro Passo - Número de harmónicos em comum entre duas notas
H*Recebe duas listas de fracções e frequências das
parciais de duas notas diferentes e devolve o número de parciais
em comum das duas notas e as frequências respectivas.*L
NumCons = Function@8x, y<, Module@8t1, t2, j, total, res<,
t1 = Table@x@@iDD@@2DD, 8i, Length@xD<D; H*t1 é uma lista apenas com as
frequências da nota x, já sem os intervalos relativos à fundamental.*L
t2 = Table@y@@iDD@@2DD, 8i, Length@yD<D; H*O mesmo que t1 mas para a nota y.*L
j = 1;
res = 8<;
While@j <= Length@t1D,
total = Count@t2, t1@@jDDD; H*Conta o número de vezes que a frequência do
j-ésimo harmónico da nota x aparece nos harmónicos da nota y.*L
res = Append@res, 8t1@@jDD, total<D; H*Cria a lista com a
frequência analisada e o número de vezes que ambas as notas,
x e y, têm esta frequência em comum.*L
j = j + 1D;
Sort@DeleteDuplicates@resDDDD;
H*Apaga as frequências que foram analisadas mais que
uma vez e coloca por ordem crescente das frequências.*L
NumCons@a, bD H*Teste para o número de frequências em comum
entre 20 harmónicos da nota Lá 440 Hz e da nota Mi 660 Hz.*L
74
Printed by Mathematica for Students
3
4
Consonance in Music and Mathematics.nb
b2 = CalcFreq@660, 10D
NumCons@a, b2D H*Teste para verificar se o programa
calcula as frequências em commum mesmo quando as notas
não apresentam o mesmo número de harmónicos calculados.*L
c = CalcFreq@1, 30D;
d = CalcFreq@H3  2L, 30D;
Rationalize@NumCons@c, dDD
H*Teste para verificar que se em vez de frequências de duas notas diferentes,
colocarmos o intervalo relativamente a uma das notas o
programa calcula também os intervalos em comum nas parciais.*L
Segundo Passo - Utilização de funções peso para modular timbres e consonância normalizada
Os programas criados a partir de agora vão considerar apenas 30 harmónicos para as frequências fundamentais
pois acústicamente são inaudíveis frequências tão agudas como as de harmónicos superiores ao 30 - ésimo.
CalcPeso = Function@8f, freq<,
H*Recebe uma função f e uma frequência fundamental e calcula os 30
harmónicos dessa frequência e o peso atribuido a cada um deles.*L
ReplacePart@Table@8f@iD, i * freq<, 8i, 1, 30<D, 81, 1< ® 1DD;
H*Devolve uma lista com as frequências dos harmónicos e o peso
respectivo dessas frequências parciais provenientes da fundamental.*L
peso1 = 1  x;
Plot@peso1, 8x, 0, 30<, PlotRange ® 80, 1<D
fpeso1 = Function@x,
1  xD; H*Definição e gráfico da primeira função de peso.*L
u = CalcPeso@fpeso1, 440D
H*Experiência com o programa CalcPeso em duas notas Lá de 440 e 880 Hz.*L
h = CalcPeso@fpeso1, 880D
peso2 = E ^ H- H0.005 x - 0.005L
L;
Plot@peso2, 8x, 0, 30<, PlotRange ® 80, 1<, AxesLabel ® 8x, y<D
fpeso2 = Function@x,
E ^ H- H0.005 x - 0.005L
LD;H*Definição e gráfico da segunda função de peso.*L
peso3 = 1 - Hx  30L;
75
Printed by Mathematica for Students
Consonance in Music and Mathematics.nb
Plot@peso3, 8x, 0, 30<D
fpeso3 = Function@x,
1 - Hx  30LD;H*Definição e gráfico da terceira função de peso.*L
i = CalcPeso@fpeso2, 440D;
j = CalcPeso@fpeso3, 880D;
Consonancia1 = Function@8l, j<, H*Este programa recebe duas listas constituídas
por elementos da forma 8peso da frequência,frequência< e devolve
uma consonância relativa das frequências fundamentais das listas.*L
Module@8i = 1, w = 8<<,
For@i = 1, i <= Length@lD, i ++, AppendTo@w,
Prepend@Map@ð@@1DD &, Select@j, ð@@2DD == l@@i, 2DD &DD, l@@i, 1DDDDD;
H*Cria uma lista com os pesos das frequências em comum
em ambas as listas l e j.*L
w = Flatten@Map@If@Length@ðD != 1, 8ð<, 8<D &, wD, 1D; H*Elimina todos os
pesos da lista l que não têm uma frequência correspondente na lista j.*L
If@w == 8<, 0, H*Se não há elementos na lista final dos pesos de
frequências em comum, a consonância é automaticamente nula.*L
N@Norm@Map@Apply@Times, ðD &, wDD  Norm@Hj * lL@@All, 1DDDDD
H*Cálcula a consonância relativa.*L
D
D;
Consonancia1@i, jD
Terceiro Passo - Definição de "Critical Bandwidth" e optimização da consonância normalizada
MatrixForm@88150, 100<, 8250, 100<, 8350, 100<, 8450, 110<, 8570, 130<, 8700, 140<,
8840, 150<, 81000, 160<, 81170, 190<, 81370, 210<, 81600, 240<, 81850, 280<,
82150, 320<, 82500, 380<, 82900, 450<, 83400, 550<, 84000, 700<, 84800, 900<,
85800, 1100<, 87000, 1300<, 88500, 1800<, 810 500, 2500<, 813 500, 3500<<,
TableHeadings ® 8None, 8"Central Frequency in HzÈ", "ÈCB in Hertz"<<D
H*Tabela de frequências e respectivas frequências
das "critical bandwidth" em Hertz.*L
Plot@
Interpolation@88150, 100<, 8250, 100<, 8350, 100<, 8450, 110<, 8570, 130<, 8700, 140<,
8840, 150<, 81000, 160<, 81170, 190<, 81370, 210<, 81600, 240<, 81850, 280<,
82150, 320<, 82500, 380<, 82900, 450<, 83400, 550<, 84000, 700<, 84800, 900<,
85800, 1100<, 87000, 1300<, 88500, 1800<, 810 500, 2500<, 813 500, 3500<<, xD,
8x, 150, 10 000<, PlotRange ® 880, 5000<, 80, 1000<<D
H*Interpolação usando pontos da forma
Hfrequência central,critical bandwidth respectivaL, ambas em Hz.*L
Plot@94 + 71 * f ^ H3  2L, 8f, 0, 5<, PlotRange ® 880, 5<, 80, 1000<<,
AxesLabel ® 8"Centre Frequency in KHz", "Critical Bandwidth in Hz"<DH*Gráfico
da função empíricamente utilizada para a medida da "critical bandwidth".*L
76
Printed by Mathematica for Students
5
6
Consonance in Music and Mathematics.nb
Plot@
Piecewise@881 - H4 Abs@xD E ^ H1 - 4 * Abs@xDLL, Abs@xD < H1  4L<, 80, Abs@xD > H1  4L<<D,
8x, - 0.5, 0.5<, AxesLabel ® 8"x Critical Bandwidth", "Level of Consonance"<D
H*Função que relaciona uma fracção da "Critical Bandwidth" no eixo
dos xx com a sua consonância relativamente à frequência central.*L
ConsAux = Function@8l, j<, H*Este programa recebe duas listas constituídas
por elementos da forma 8peso da frequência,frequência< e devolve
uma consonância relativa das frequências fundamentais das listas,
tendo em conta a existência e o funcionamento da "Critical Bandwidth".*L
Module@8i = 1, w = 8< , CB, F<,
F = Function@x, Piecewise@
881 - H4 Abs@xD E ^ H1 - 4 * Abs@xDLL, Abs@xD < H1  4L<, 80, Abs@xD > H1  4L<<DD;
H*Definição da função imediatamente acima.*L
CB = Function@f, 94 + 71 * Hf * 10 ^ - 3L ^ H3  2LD;
H*Definição da critical bandwidth para cada frequência f.*L
For@i = 1, i <= Length@lD, i ++,
AppendTo@w, Map@8ð, l@@iDD< &, jDD;
D;
w = Flatten@w, 1D; H*Cria uma lista com a combinação de todas
as frequências e pesos da lista l com os mesmos da lista j.*L
w = Map@
8ð@@1, 1DD, ð@@2, 1DD, HHF@HðP1, 2T - ðP2, 2TL  CB@ðP1, 2TDD +
F@HðP1, 2T - ðP2, 2TL  CB@ðP2, 2TDDL  2L  N< &, wD;
H*Cria uma lista com elementos da forma 8peso da lista j, peso da lista l,
média das consonâncias de cada uma das frequências analisadas<.*L
w = Select@w, ð@@3DD ¹ 0 &D; H*Elimina todos os elementos de
w em que a média das consonâncias é 0.*L
N@Map@Apply@Times, ðD &, wDD H*Multiplica os pesos e a
consonância de cada elemento da lista w.*L
DD;
Consonancia = Function@8i, j<,
Norm@ConsAux@i, jDD  HSqrt@HNorm@ConsAux@i, iDD * Norm@ConsAux@j, jDDLDLD;
H*Normaliza a consonância utilizando o programa ConsAux.*L
Consonancia2 = Function@8i, j<,
H*Print@ConsAux@i,jDD;Print@ConsAux@i,iDD;Print@ConsAux@j,jDD;
Print@Norm@ConsAux@i,jDDD;
Print@Norm@ConsAux@i,iDDD;Print@Norm@ConsAux@j,jDDD;*L
Norm@ConsAux@i, jDD  Norm@Hi * jL@@All, 1DDDD;
Consonancia@i, jD
77
Printed by Mathematica for Students
Consonance in Music and Mathematics.nb
3. Aplicação do programa a temperamentos
Pythagorean =
FunctionAf, H*Este programa recebe uma frequência f em Hz e devolve uma tabela
com as consonâncias para a escala maior pitagórica começando na nota
com a frequência f como fundamental. A função de peso para o timbre
utilizada é fixa e igual a
1-x
,
30
pois utilizando outra qualquer função peso,
a consonância relativa entre intervalos da escala seria semelhante.*L
GridA98"Tonic", "Minor Second", "Major Second",
"Minor Third", "Major Third", "Perfect Fourth", "Augmented Fourth",
"Perfect Fifth", "Minor Sixth", "Major Sixth", "Minor Seventh",
"Major Seventh", "Octave"<, MapAApply@Consonancia2,
8CalcPeso@funcaoPesoIdeal, fD, CalcPeso@funcaoPesoIdeal, Hð * fLD<D &,
256 9 32 81 4 1024 3 128 27 16 243
91,
, ,
,
, ,
, ,
,
,
,
, 2=E=, Frame ® AllEE;
243 8 27 64 3
729
2
81
16
9
128
Pythagorean@440D
Just = FunctionAf,
H*Este programa faz o mesmo que o anterior mas para a escala maior pura.*L
GridA98"Tonic", "Minor Second", "Major Second", "Minor Third", "Major Third",
"Perfect Fourth", "Augmented Fourth", "Perfect Fifth", "Minor Sixth",
"Major Sixth", "Minor Seventh", "Major Seventh", "Octave"<,
MapAApply@Consonancia2, 8CalcPeso@fpeso2, fD, CalcPeso@fpeso2, Hð * fLD<D &,
91,
16
9
,
15
6
,
8
5
,
5
4
,
4
45
,
3
3
,
32
8
5
,
2
,
5
9
,
3
15
, 2=E=, Frame ® AllEE;
,
5
8
Just@440D
QuarterCommaMT = FunctionBf, H*Este programa faz o mesmo que o anterior
mas para a escala maior mesotónica de um quarto de comma.*L
GridB:8"Tonic", "Minor Second", "Major Second", "Minor Third", "Major Third",
"Perfect Fourth", "Augmented Fourth", "Perfect Fifth", "Minor Sixth",
"Major Sixth", "Minor Seventh", "Major Seventh", "Octave"<,
MapBApply@Consonancia2, 8CalcPeso@fpeso2, fD, CalcPeso@fpeso2, Hð * fLD<D &,
:1,
5 ´ 534
16
25
16
Sqrt@5D
,
,
2
H5 ^ H3  4LL
2
531 441
5
,
,
131 072 ´
534
531 441
,
,
131 072
5
2
,
4
H5 ^ H1  4LL
H5 ^ H5  4LL
4
5
5
,
8
, 5 ^ H1  4L,
, 2>F>, Frame ® AllFF;
QuarterCommaMT@440D
78
Printed by Mathematica for Students
7
8
Consonance in Music and Mathematics.nb
SixthCommaMT = FunctionBf, H*Este programa faz o mesmo que o
anterior mas para a escala maior mesotónica de um sexto de comma.*L
GridB:8"Tonic", "Minor Second", "Major Second", "Minor Third", "Major Third",
"Perfect Fourth", "Augmented Fourth", "Perfect Fifth", "Minor Sixth",
"Major Sixth", "Minor Seventh", "Major Seventh", "Octave"<,
MapBApply@Consonancia2, 8CalcPeso@fpeso2, fD, CalcPeso@fpeso2, Hð * fLD<D &,
:1,
45 ´ 313 516
323 513
,
64 ´ 213
45 ´ 323 513
,
2 ´ 223
3
65 536
,
4
3
3
23
5
3 13
I 10 M
65 536
5
8
3
3
8
2
,
13
45
,
516
2
,
2 I3M
2
13
,
177 147
5
,
64 ´ 223
177 147
3
13
,
32
516 ,
2
23
556 , 2>F>, Frame ® AllFF;
SixthCommaMT@440D
EqualTemperament = FunctionAf,
H*Este programa faz o mesmo que o anterior mas para a escala maior igual.*L
GridA98"Tonic", "Minor Second", "Major Second", "Minor Third", "Major Third",
"Perfect Fourth", "Augmented Fourth", "Perfect Fifth", "Minor Sixth",
"Major Sixth", "Minor Seventh", "Major Seventh", "Octave"<,
MapAApply@Consonancia2, 8CalcPeso@fpeso2, fD, CalcPeso@fpeso2, Hð * fLD<D &,
91, 2112 , 216 , 214 , 213 , 2512 , 212 , 2712 ,
223 , 234 , 256 , 21112 , 2=E=, Frame ® AllEE;
EqualTemperament@440D
Scale53 = FunctionAf, H*Este programa faz o mesmo
que o anterior mas para a escala dividida em 53 partes.*L
GridA98"Tonic", "Short Minor Second", "Long Minor Second",
"Major Second", "Short Minor Third", "Long Minor Third", "Major Third",
"Perfect Fourth", "Short Augmented Fourth", "Long Augmented Fourth",
"Perfect Fifth", "Short Minor Sixth", "Long Minor Sixth", "Major Sixth",
"Short Minor Seventh", "Long Minor Seventh", "Major Seventh", "Octave"<,
MapAApply@Consonancia2, 8CalcPeso@fpeso2, fD, CalcPeso@fpeso2, Hð * fLD<D &,
91, 2453 , 2553 , 2953 , 21353 , 21453 , 21853 , 22253 , 22653 , 22753 , 23153 ,
23553 , 23653 , 24053 , 24453 , 24553 , 24953 , 2=E=, Frame ® AllEE;
Scale53@440D
4. Frequency Spectra of Orchestra Instruments
Auxiliar functions
calculateTransform = Function@data,
Abs@Fourier@dataDDD;
79
Printed by Mathematica for Students
Consonance in Music and Mathematics.nb
filterData = Function@8x, inf, sup<,
Drop@Take@x@@All, 1DD@@1, 1DD, supD, infDD;
audibleCoordinates = Function@8data, rate<,
Select@Transpose@8Range@0, HLength@dataD - 1LD Hrate  Length@dataDL, data<D,
ð@@1DD £ 20 000 &DD;
localMaximum = Function@list, Module@8i<,
i = 1;
While@list@@i + 1DD >= list@@iDD, i ++D;
iD
D;
convertToHarmonics = Function@x, Module@8list1, list2, newList1, newList2<,
list1 = Map@ð@@1DD &, xD;
list2 = Map@ð@@2DD &, xD;
newList1 = list1 H1  list1@@Position@list2, Max@list2DD@@1, 1DDDDL;
newList2 = list2  Max@list2D;
Transpose@8newList1, newList2<DDD;
convertToHarmonicsNotFundamental =
Function@8x, freq<, Module@8list1, list2, selectList, max, newList1, newList2<,
list1 = Map@ð@@1DD &, xD;
list2 = Map@ð@@2DD &, xD;
selectList = Select@x, ð@@1DD <= freq + 20 && ð@@1DD >= freq - 20 &D;
max = Max@Map@ð@@2DD &, selectListDD;
newList1 = list1 H1  list1@@Position@list2, maxD@@1, 1DDDDL;
newList2 = list2  Max@list2D;
Transpose@8newList1, newList2<DDD;
meanMeasurements = Function@x,
Mean ž Transpose@xDD;
80
Printed by Mathematica for Students
9
10
Consonance in Music and Mathematics.nb
In[1]:=
DoRoutine = Function@8wav, x, filter<,
Module@8wavData, wavRate, wavCoordinates, wavHarmonics, list, i<,
list = 8<;
wavData = 8filterData@wav, filter, filter + 20 000D,
filterData@wav, filter + 5000, filter + 25 000D,
filterData@wav, filter + 10 000, filter + 30 000D<;
wavRate = wav@@1, 2DD;
H*Print@ListPlot@wavDataDD;*L
wavCoordinates = audibleCoordinates@
meanMeasurements@Map@calculateTransform, wavDataDD, wavRateD;
wavHarmonics = If@x Š 0, convertToHarmonics@wavCoordinatesD,
convertToHarmonicsNotFundamental@wavCoordinates, xDD;
H*Print@ListPlot@wavCoordinates,PlotRange®All,
Filling®Axis,PlotJoined®TrueDD;*L
Print@ListPlot@Select@wavHarmonics, ð@@1DD £ 20 &D, PlotRange ® All,
Filling ® Axis, PlotJoined ® True, DataRange ® 80, 20<DD;
wavHarmonics
For@i = 1, i < 32, i ++,
l = Select@wavHarmonics, i - 0.2 < ð@@1DD < i + 0.2 &D;
AppendTo@list, Select@l, ð@@2DD Š Max@Map@ð@@2DD &, lDD &D@@1DDD;
D;
list
DD;
Export@"consonance.pdf", EvaluationNotebook@DD
mynotebook.pdf
81
Printed by Mathematica for Students