Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 12

Optimality in musical melodies and harmonic progressions:

the Travelling Musician

Title: Optimality in musical melodies and harmonic progressions: The travelling musician.
Author: Daniel Schell, Composer, Engineer (ULB), M.Sc. Operational Research (LSE)
Topics keywords: n° 6. Combinatorial optimisation; n° 57. OR applications in other domain:
musical composition.
Conference of the author with musical examples played by Judith Gudor (clarinet) and
Emese Mali (synthesiser). A fuller version of this paper has been published in the EJOR
journal.

Abstract
A "chord" is a vertical set of notes. A "melody" is a path going through these chords
considered as a graph. The author describes an algorithmic approach to the generation of tiles,
group of chords, connected along remarkable paths.
The traditional harmony is based on a set of rules such as variety, connectivity, tiling,
enumeration which eventually produces a 'beautiful' and 'interesting' melody/chord
relationship. A set of rules and criteria are defined in order to evaluate this melody/chord
relationship.
The compositional program contains two algorithms:
1 ) The first generates a list of possible sets of chords fulfilling the optimality criteria.
2) The second connects them and evaluates the criteria for each paths.
A selection of the best tiles is then made with the help of the composer. A beautiful tile -
or 'beau karo' as the author names them - might show - or not – high symmetry and
remarkable connectivity. The best tiles given by the algorithms are compared to the ones in
usage by the tradition.

Euro has commissioned the author for two musical compositions. First, 'The Travelling
Musician' a brass quintet for the Hungarian Ensemble 'Brass in the Five' directed by Peter
Burget and Gergely Vajda. Then 'Ten optimal studies' a set of pieces for various ensembles.
Frequent references are made to this pieces of music.
The algorithms presented here were thought as helping devices for the composer, more
than complete algorithms which would for instance produce Bach like music without any
human intervention.

First definitions
1.1 Chromatic set of notes on Z-12.
Traditional music accepts 12 notes per octave. We assign an integer value to each note.
With (C=0; C# OR Db =1; D=2; D# or Eb = 3; E = 4; F = 5; F# OR Gb =6; G =7; G# OR Ab
= 8; A = 9; A# OR Bb =10; B =11) .
MOD 12 (A) insures that note A remains in the range 0 <= A <=11
Intervals
The interval is the number of half-tones between two notes.
INTERVAL: ('unison' =0; 'minor second' OR 'half tone' =1; 'major second' OR 'tone'=2;
'minor third'=3; 'major third'=4; 'fourth' = 5; 'augmented fourth' OR 'diminished fifth' 6;
'fifth'=7; minor sixth'=8; 'major sixth'=9; 'minor seventh'=10; 'major seventh'=11;
'octave'=12)
1.2 Scales

Figure 1-1 The diatonic major scale figured by letters, then by digits from Z-12
The advantage of figuring by numerals is that we can learn about the constitution of the
scale into tones (equivalent to two half-tones) and half-tones. The successive intervals are (2,
2, 1, 2, 2, 2, 1).
1.3 Melodies
A melody is a horizontal set of connected notes perceptible as such.

Figure 1-2 The first part will be clearly perceived as a melody. The second part will be
perceived a set of disconnected note.
1.3.1 Rules for an optimal melody
1. It should be well connected.
2. It should show a degree of variety with intervals such as +1, -1, +2, -2, +3, -3…
3. Small intervals should be more frequent than large ones.
4. It should start from a note, explore a region, then come back to a neighbour of this note.
1.3.2 The algorithmic generation of melodies. Two methods:
1 Use existing melodies. Then transform these melodies by operations such as
transposition, inversion, retrograde or any type of transformation. This method has been
used in the 'Two Italian Trios' from the author.
2 Generate melodies using a random or fractal generator, or any type of non musical data.
1.3.2.1 Random fractal and Brownian melodies

Figure 1-3 A Brownian or random fractal chromatic melody. The trombone solo in the
first part of the Travelling Musician, bars 44 and foll. .
We adopt the graph of a Brownian motion. With ∆ y= + or – 1 half-tone we produce the
chromatic melody of Figure 1-3. The melody is clearly well connected. However the step is
always = | 1| and this is against rule 2 of the optimal melody. Furthermore such melodies can
go far away from their starting point and this is against rule 4.

Figure 1-4 A Brownian diatonic melody. The Horn solo in the Travelling Musician, part
1, bars 71 and foll. The same melody, given to the trumpet (bar 80) is treated as a fugue.
The Brownian motion is mapped to a diatonic scale (5, 7, 9, 10, 0, 2, 3). In this case we
choose ∆ y from the values (1, 2, -1, -2).
1.3.2.2 Random Normal Gaussian melodies
Figure 1-5 A Gaussian walk in a diatonic space. 'fantasy of a happy driver' is the title of
the solo fluegelhorn (the Travelling Musician, part 1, bars 13 and foll.)
We start from a note, say 0, and at each step we add interval from the distribution. If the
melody goes to far up or down we re-adjust with an octave step (see the arrow under the note
7). If we take the same distribution, but apply it to the chromatic notes, we obtain the melody
from Figure 1-6.

Figure 1-6 A Gaussian chromatic walk. The tuba solo (The travelling musician, part 1,
bars 95 and foll.)
.
2 Analysis of some traditional chord sequences
2.1 Harmonic and name- triads

Figure 2-1 Three major triads, figured as Harmonic Triads - H-Triads - then as relative
Triads - R-Triads.
Definition: an harmonic triad H-triad is an array of three different elements, whose values
range between 0 and 11.
H-Triad = = (i, j, k) ; i ≠ j ≠ k ; 0 < = i, j, k < = 11 ;
A relative triad R-triad is written under the form m, n(r)
m, n (r) = = ( r, m + r, m + n + r)
The advantage of the R-triad figuring is that it shows the successive intervals between the
elements of the triads. It brings information on the interval structure of the triad.
Open and closed forms of a triad
Figure 2-2 The three closed and three open forms of the H-triad (0, 4, 7)
The six permutations of a triad contain two categories, open and closed triads.
The ambitus is the interval difference in half-tones, measured between the highest and the
lowest note of a triad. Then the triad is closed if its ambitus < 12, otherwise it is open.
To obtain the Name-Triad: Take a H-triad. Generate its six permutations. Choose the H-
Triad with the shortest ambitus. R-Triad.

2.2 The 4,3 sequence from the musical tradition


Let us choose the following restrictive definition: A chord is a triad on a bass note: m, n (r) /b

Figure 2-3 The traditional 4-chords sequence built on degrees 0, 5, 7, 0 the major scale.

Chord1 Salto Chord 2 salto Chord 3 salto Chord 4 Total absolute


4,3(0) 4,3(5) 4,3(7) 4,3(0) melodic salto
notes notes notes notes
Voice 1 0 0 0 -1 11 +1 0 2
Voice 2 4 +1 5 -3 2 +2 4 6
Voice 3 7 +2 9 -2 7 0 7 4

Triad 12
Bass 0 +5 5 -10 -5 (or 7) +5 0

Table 1 lists in integer figures the musical data of Figure 2-3

First of all, we see that we have vertical columns corresponding to the chords, then horizontal
lines corresponding to the voices. A voice is a horizontal set containing the notes of a given
level of the chords.
Rules to form a good traditional 4-chord sequence
Rule 1 Covering. All the notes of a given scale should be included in the four triads.
Rule 2 Surprise. The triads contain different notes in order to produce surprise and variety.
Rule 3 Connection. The triads are smoothly connected one to each other. Suppose chords 1
and 2; then the inversion of chord 2 which we choose is the one which minimises the number
of steps or absolute salto with chord 1. The Total Absolute Salto (TAS) between the 4 triads
should be small.
Rule 4 Structure. All the chords of the sequence have an equal or analogue structure
Rule 5 Voice Pattern. One of the voices, here the bass, does not have necessarily to follow
the rule of connection. In this case, it follows a kind of pattern.
3 Some beautiful tiles
3.1 The major-minor 4,3-3,4 sequence.

Figure 3-1 the 2*(4,3), 2*(3,4) 'beautiful tile'. Left on the score, right on the circle.

4,3(0) Salto 3,4(8) salto 4,3(10) salto 3,4(9) Total absolute


notes notes notes notes salto
Voice 1 0 -1 11 -1 10 -1 9 4
Voice 2 7 +1 8 -3 5 +1 6 5
Voice 3 4 -1 3 -1 2 -1 1 4

Triad 13
Bass 4 +7 11 -9 2 +7 9
Let us verify the optimality rules:
Rule 1 Covering. A partition of the chromatic scale (0…11). Maximum information.
Rule 2 Surprise. The triads contain all different notes. Maximum variety.
Rule 3 Connection. TAS (Total Absolute salto) of 13, excellent result.
Rule 4 Structure. There are two 4,3 and two 3,4 chords.
Rule 5 Voice Pattern. The bass line follows a balance pattern +7, +7.
The voices are so well connected that one could accept them as 'melodies' going though
the chords. Listen to the second part of Optimal Study N° 3 (from bar 36), built on this
beautiful tiling.
3.2 Some beautiful tiles
Definition: 'a beautiful tile' is a partition of Z-12 into 4 mutually exclusive triads, having
either (four identical m,n) or (two m,n and two n,m) structures. The other has named these
particular tiles 'karos' from the French 'Beaux carreaux'.
3.2.1 Beautiful karo ( 2,4 - 4,2 )

Figure 3-2 A beautiful karo with high connection. The bass is not shown.

2,4(8) Salto 2,4(9) salto 4,2(0) salto 4,2(1) Total absolute


notes notes notes notes salto
Voice 1 2 1 3 1 4 1 5 3
Voice 2 10 1 11 1 0 1 1 3
Voice 3 8 1 9 -3 6 1 7 5

Triad 11
Table 2
The TAS of 11 is the smallest we have met so far. This highly connected chords can give a
'flowing' effect which the author has used in 'The Travelling Musician' to simulate the flow of
the traffic on a road. (For instance in bars 63-70). Listen also to the first bars (1-2) of the
Optimal study N° 3 'Choral'.

3.2.2 Beautiful karo 1,1


Figure 3-3 The four triads 1,1
This beautiful karo is difficult to connect and shows a minimum absolute salto of 29, the
highest we have met so far. Given the bad connection, it will be difficult to identify the
respective voices to a melody. This tile is used in Optimal Study N° 1 for tuba and trombone.
It is felt that the triads themselves are melodies, as in the trombone, (bar 1) : ( 7, 8, 9, 8, 7).

3.2.3 Beautiful karo 2,3 – 3,2

Figure 3-4 Left: the tile 2,3-3,2 represented as a melody. Right: the same on a circle
We see (Figure 3-4) , that the notes of the 4 triads placed one after each other present already
a melodic character. Let us represent the same tile, this time connected:

Figure 3-5 The same karo connected, represented without the bass.
The connecting algorithm shows that this tile has a TAS of 17 which is rather good.
The voices which go through the triads are made of steps of 1, 2 or 3; a good melody.
This tile shows both characters of good connection and interesting melody. Optimal studies
N°2 and specially N°9 are entirely based on its properties.
4 The algorithmic generation of tiles
The following algorithms have been conceived in order to fit in extremely small computer
memories.
4.1 Generation of a list of tiles in lexicographic order
Suppose that we want to generate a list of all existing tiles. This list will be useful either for
composing purposes, or just to check the existence of a given tile. The total number of these
partitions of Z-12 into 4 triads is 12! / (4! * (3!)E4) = 15.400.
We can reduce this problem to a list of the co-sets of a given triad.
Suppose that we have a triad, say (0, 4, 7) , then we have to create the list of partitions of
(1, 2 , 3, 5, 6, 8, 9, 10, 11) into three triads. (1)
Replace the list (1) by (0…8) . The problem is equivalent to create a list of partitions starting
with:
(0, 1, 2) (3, 4, 5) (6, 7, 8). (2)
We wish to choose the lexicographic order. If we take the first triad of (2) and keep the 0
fixed, then we shall generate (C 8 into 2) = 28 combinations of the first triad.
For each value of triad 1, we have 2 triads left, as (3, 4, 5) (6, 7, 8)
Again, if we keep the 3 fixed, we will generate (C 5 into 2) = 10 combinations, successively:
The total number of co-sets of a given triad will be 10*28= 280.
The algorithm is designed in order to return a given line of lexicographic list.
Example: Given a first set (1, 2, 3) (5, 6, 8) (9, 10, 11)
The 116th lexicographic partition of this set would be (10, 1, 3) (2, 6, 9) (4, 3, 6)
4.2 The connection of tiles
The connection of triads one to each other, will produce smoot voice steps. Again, we wish to
save the resources of the singer.
Given a 4-triads sequence, the algorithm will connect the triads two by two. Suppose we have
4 triads A, B, C, D. We search first which is the best connection between A and B. We
compute a TAS (Total absolute salto) for each inversion of B and choose the one with the
MINTAS.
We then assume that:
MINTAS (ABCD) = MINTAS (AB) + MINTAS (BC) + MINTAS (CD)
(1)
We should now compute the MINTAS for all the 4!=24 Permutations of the path ABCD.
As the function MINTAS is reflexive, we need only to compute it on 12 pathes.
The algorithm will be further simplified by the fact that there are only (C 4 into 2) = 6 two-
triads pathes, namely AB, AC, AD, BC, BD,
CD. (2)
The algorithm will then be:
Compute MINTAS for the 6 pairs (2).
Compute the values of the TAS on the twelve pathes (ABCD).
The minimum MINTAS will be the best connected 4-triads sequence.
This problem may also be solved using a 'Travelling Salesman Problem', TSP-type
algorithm. We represent the 4 chords of section 3.1 on the graph shown in Figure 6. The
edges between any two vertices carry 'weights' corresponding to the TAS calculated for each
2-triad pair. We can see easily that there are two optimal solutions, both with a TAS of 11.
Figure 6 On the left, the graph of the connections of the karo 4,3-3,4. The solution is
equivalent to the shortest path in a travelling salesman problem. On the right are
the two solutions.
Many types of algorithms can be used to solve this problem. For instance, the dynamic
programming type of algorithm given in Horowitz and Sahni (1978, p232-233) gives the same
results. Any minimum spanning tree algorithm can also be adapted to this type of problem.
(For a discussion see Khuller & Raghavachari 1979, p 6-13 to 6-19).
The author is presently working with Ola Rinta-Koski, on a new LISP Karo engine,
which will generate, connect optimally and analyse series of 'karos'.

Thank you to Elaine Chew for her precious help in editing the text and to Philippe Van
Asbroek for having organised the EURO performance.
Bibliography
Barbaud, Pierre (1968), La musique, discipline scientifique. Dunod, Paris.
Barbaud, Pierre (1983), Vademecum de l'ingénieur en musique. Springer Verlag.
Balzano, Gerald. J.(1980) The Group-theoretic Description of 12-Fold and Microtonal Pitch
Systems. Computer Music Journal, MIT Press, Vol 4 No 4, p 66
Bidlack R (1992) ‘Chaotic system as simple (but Complex) Compositional Algorithm’.
Computer music Journal. MIT. 16:3. pp 33-47.
Boon Jean-Pierre and Olivier Decroly (1995). ‘Dynamical systems theory for music
dynamics’. Chaos 5(3); 501-508
Brindle, Reginald (1966) ‘Serial Composition’ Oxford University Press
Chew, Elaine (2001): Modeling Tonality: Applications to music cognition. In: Moore J.D.,
Stennings K., (Eds). Proceedings of the 23rd Annual meeting of the Cognitive Science
Society. Lawrence Erlbaum, Mahwah, NJ.
Clarke, J., and Voss, R. F. (1978). "1/f Noise in Music: Music from 1/f Noise." Journal of the
Acoustical Society of America, 63(1), 258-263.
Cohn, Richard (1998): “Introduction to neo-Riemannian theory”. Journal of Music Theory,
Vol 42, pp 167-180.
Cohn, Richard: “Neo-Riemannian Operations, Parsimonious Trichords and their Tonnetz
representations." Journal of Music Theory.
Forte, Allen. (1973) The structure of atonal music. Yale University press
Gardner, Martin. (1978). "White and Brown Music, Fractal Curves and 1/f Fluctuations."
Scientific American, 238(4), 16-31
Gilber, Steven. (1974) Introduction to trichordal analysis. Journal of musical theory. 18/2
1974.
Hastings H.M & Sugihara G. (1993), Fractals, a user's guide for the natural sciences. Oxford
University press.
Hauer, Mathias (1926) ‘Zwölftontechnik’ die Lehre von den Tropen, Universal Edition, Wien
Hörnel D. and Menzel W. (1998)‘Learning Musical Structure and style with Neural
Networks’ Computer Music Journal,MIT, 22:4, pp 44-62
Horowitz, Ellis & Sahni, Sartaj (1978): Fundamentals of Computer Algorithms. Computer
Science Press,
Khuller, Samir & Raghavachari, Balaji (1999) : Basic Graph Algorithms. In 'Algorithms and
theory of computation handbook. Edited by M.Atallah. CRC Press.
Lerdahl and Jackendorf (1983) ‘A generative theory of Tonal Music’ Cambridge,
Massachussets. MIT Press
Lewin, David (1987) : ‘Generalised Musical intervals and transformations’ Yale University
Press
Longuet-Higgins H.C. and Steedman M. (1971) ‘On interpreting Bach’ Machine Intelligence
6; pp221-241
Mc Alpine, Miranda & Hogar (1999) ‘Making music with algorithms. A case study system’.
Computer Music Journal, 23-2, pp19-30.
Roads, Curtis (1966) The computer music tutorial. Cambridge, Massachussets. MIT Press
Sayegh, Samir (1989) ‘Fingering for string instruments with the optimum path paradigm’.
Computer Music Journal, 13:3 pp 76-83.
Schell, Daniel (1983) Quelques beaux carreaux, Clic Music, Brussels.
Schell, Daniel (1990,1999): L'enfoui fuit. Clic Music
Schell, Daniel (2000) The travelling musician, Clic Music.
Schell, Daniel (2000) Optimal Studies; Edition Simonffy, Budapest.
Schillinger, Joseph, (1976) The mathematical basis of the arts, Da Capo Press, NY.
Slonimsky, Nicolas (1947). Thesaurus of scales and melodic patterns. (repr 1975) Duckworth,
London.
Taube, Heinrich (1997) ‘An introduction to Common Music’ Computer Music Journal, 21:1,
pp 29-34.
Temperley D. & Sleator D.(1999) ‘ Modeling Meter and harmony: A preference-rule
approach’ Computer Music Journel, MIT, 23:1, pp 10-27

You might also like