You are on page 1of 8

Complex Networks of Harmonic Structure

in Classical Music

Florian Gomez, Tom Lorimer, and Ruedi Stoop

Institute of Neuroinformatics,
University of Zurich and ETH Zurich,
Winterthurerstrasse 190, 8057 Zurich, Switzerland
{fgomez,lorimert,ruedi}@ini.phys.ethz.ch

Abstract. Music is a ubiquitous, complex and defining phenomenon of


human culture. We create and analyze complex networks representing
harmonic transitions in eight selected compositions of Johann Sebastian
Bach’s Well-Tempered Clavier. While all resulting networks exhibit the
typical ‘small-world’-characteristics, they clearly differ in their degree
distributions. Some of the degree distributions are well fit by a power-law,
others by an exponential, and some by neither. This seems to preclude
the necessity of a scale-free degree distribution for music to be appealing.
To obtain a quality measure for the network representation, we design a
simple algorithm that generates artificial polyphonic music, which also
exhibits the different styles of composition underlying the various pieces.

Keywords: Complex Networks, Music, Harmony, Artificial Music.

1 Introduction
In recent years, the network-based approach to complex biological, social or
technical systems has become increasingly popular. Especially since the terms
‘small-world’ and ‘scale-free’ networks were coined [1,2], the structural properties
of systems as diverse as power grids, co-authorship networks, protein- interac-
tion networks, or the brain have been analyzed for these properties (see [3] for
a review). More recently, pitch transitions/fluctuations in classical and popular
music were studied from a similar complex network perspective [4,5,6]. This ap-
proach, however, poses one relevant and fundamental question: it is a priori not
clear how to meaningfully define nodes and links for a network representation
of a (complex) musical piece. In this article, we apply a simple but musically
justified procedure to create networks from classical music compositions by re-
stricting ourselves to a representation solely based on harmony (co-occurring
notes). In contrast to the popular corpus-based studies (e.g. [5,7]), we adhere to
the view that “a single piece is normally the largest unit of artistic significance”
[8,9] and therefore treat the musical pieces individually. As a measure for the
quality of the representation, we use the appeal of polyphonic music generated
from a simple artificial music generating algorithm. This allows us to assess the
suitability of the general approach for the different compositions.

V.M. Mladenov and P.C. Ivanov (Eds.): NDES 2014, CCIS 438, pp. 262–269, 2014.

c Springer International Publishing Switzerland 2014
Complex Networks of Harmonic Structure in Classical Music 263

Music is often regarded as a truly universal language, yet it can provoke strik-
ingly different emotions among different people. Trying to understand the beauty
(and often the associated complexity) of music has thus been a subject of in-
terest for thousands of years, and continues to be a topic across different fields.
From a physical or mathematical point of view, different aspects of music may be
addressed, such as the physical properties of sound itself (acoustics), the notion
of salient perception-related characteristics such as ‘pitch’, or the mathematical
rules underlying consonance and dissonance. In the past decades, some of the
attention has shifted towards the investigation of the statistical properties of
music. In 1978, Voss and Clarke reported that the spectral density of loudness
fluctuations in music and speech approximately follows a 1/f-law [10] (which is
related to the notion of self-organized criticality [11]). A later and more detailed
study then showed that distinct power-law scaling exponents of these fluctua-
tions characterize different genres of music [12]. Extending the time series based
approach with the help of the tools from dynamical systems theory, entropy and
complexity measures have been derived and applied to a variety of compositions
dating from three centuries [9,13]. Paralleling work on text corpora, comparisons
between occurrence distributions and Zipf’s law have been made [14,15]. In the
complex network field, different approaches were taken to create networks from
musical pieces. Liu, Tse and Small [4] based their study on individual notes (in-
cluding duration), pooled over different collections of compositions and used an
algorithm to create artificial (however single-voiced) music. More closely related
to our study, a thorough investigation by Serrà et al. [5] characterized the evolu-
tion of popular music in terms of harmony-network properties, where the notes
within one beat determined the network nodes. While both of these studies ad-
dressed overall characteristics of music, in the following we focus on individual
compositions, the characteristics they share, and the differences that separate
them.

2 Methods
2.1 Network Creation
We created networks from 4 preludes and 4 fugues from Johann Sebastian Bach’s
Well-Tempered Clavier, volume I. The music notes were automatically read-in
from freely available MIDI-files, but, with the help of the original score, care-
fully corrected by hand (a necessary step due to the often imperfect MIDI-files;
moreover, trills and mordents were removed). From the score, the networks were
generated as depicted in Fig. 1.
Nodes are defined by co-occurring notes, and a link aij is drawn if node j
follows node i. Since we only focus on the harmonic structure, absolute pitch val-
ues, note duration, multiple occurrences of notes and possible permutations of
notes among the voices are ignored. For example, in a piece with four voices, the
co-occurrence of the notes (C4, G4, C5, E5) is described by the node (C, E, G)
(i.e., C Major). In this way, nodes correspond to single notes (e.g. (C)), dou-
ble notes (e.g. (C, E)), triads (e.g. (C, E, G)), four notes (e.g. (C, E, G, A)), etc.
264 F. Gomez, T. Lorimer, and R. Stoop

a) b)
1) F5 Eb5 D5 C5 Bb4 Ab4 G4 F4 Ab5 G5 F5
2) C5 - - F5 Eb5 D5
3) - C4 B3 C4 G3 Ab3 C4 B3 C4 D4

c)
(C,F) (C,Eb) (C,D,B) (C) (C,Bb) (G,Ab) (G) (F,Ab) (C,F,Ab) (F,Ab,B) (C,Eb,G) (D,F)

Fig. 1. Network creation. a) Original score (Fugue c-minor, bar 7), b) transcribed score,
c) network nodes and links.

While this is similar to the approach of Ref. [5], here we apply a criterion of strict
note co-occurrence, which seems (from the point of view of harmonic structure)
more justified for classical music than a beat-based procedure. (We do, however,
avoid more music-theoretically elaborate grouping methods, see e.g. [16].) To
put weights on the links, we simply increase the weight wij by 1 whenever the
transition aij occurs (see also [4]). For simplicity and without much loss of gen-
erality (see below), we concentrate on undirected networks, where in the case of
the weighted networks, the weights wij and wji are added.

2.2 Generation of Artificial Music

The mapping from the musical score to the network is a projection-like operation,
with considerable associated losses of musical information. To check the validity
of the approach, a simple algorithm to generate artificial polyphonic music is
designed. Given a network, a simple random walk on the network creates a
sequence of nodes {sk }. In the case of the weighted network, the next node is
chosen with a probability corresponding to the respective link weight (similar to
Ref. [4]). To map this sequence back to a truly polyphonic piece, the notes have
to be assigned to the different voices in some way (a problem known as ‘voice
leading’, see also [17]). Here, we adopt a simple procedure which is inspired
by the old style of basso continuo playing. In accord with the first node s1
in the artificial sequence (e.g. s1 = (C, G, Bb)), we assign a starting point (in
the case of three voices, e.g. (C3, G3, Bb3)). To obtain the next state, of all
possible note permutations and absolute pitches consistent with the next node
s2 , the configuration is chosen that minimizes the total variation of the voices
(measuring the variation in units of semitones). For the example above, if s2 =
(C, F, A), the next state would be (C3, F 3, A3): the lower is held constant, the
middle voice moves 2 semitones, the upper voice 1 semitone down. In the case
of multiple optimal configurations, the first solution found is chosen. In a final
step, consecutive identical notes within one voice are connected (otherwise all
notes have the same length, typically 0.25s).
Complex Networks of Harmonic Structure in Classical Music 265

3 Results

Using the procedure described above, 8 (weighted and unweighted) networks


were created and analyzed, see Table 1 and Fig. 2.

Table 1. Overview over the compositions and network measures for undirected net-
works. The length is in units of 1/16-notes (1/8-notes for the fugue in Bb minor), C
denotes the average local clustering coefficient, and L the average shortest path length.
Values in brackets correspond to random networks with the same number of nodes and
links.

Composition Voices Length Nodes/Links C L


Prelude C Major 3 560 59/120 0.50 (0.07) 3.30 (2.91)
Prelude C# Major 2 624 59/232 0.31 (0.13) 2.29 (1.98)
Prelude F minor 3-4 352 101/228 0.23 (0.04) 3.16 (3.06)
Prelude Ab Major 2-4 528 56/261 0.42 (0.17) 2.16 (1.80)
Fugue C minor 3 496 103/259 0.20 (0.05) 2.90 (2.87)
Fugue E minor 2 504 67/279 0.39 (0.12) 2.22 (1.98)
Fugue A minor 4(-5) 1392 223/826 0.25 (0.03) 2.87 (2.70)
Fugue Bb minor 5 600 128/282 0.16 (0.03) 3.42 (3.27)

Comparing to random networks of the same number of nodes and links, all
networks exhibit a high clustering coefficient and a comparably low average
shortest path length thus fulfilling the ‘small-world’ property [1]. Looking at
the individual networks in more detail, one finds a few well-connected nodes,
which typically correspond to the double notes and triads closely related to
the composition’s key (often nodes pertaining to the tonic or the dominant).
This reveals that despite the contrapuntal technique used (for the fugues), the
composition harmonically still has its weight on the classic tonal chords.
The individuality of the compositions is reflected in the degree distributions as
depicted in Fig. 3. We fitted the the degree distributions of both the weighted and
the unweighted networks (undirected in both cases) with truncated power-laws
and truncated exponentials, using maximum likelihood estimation. To statisti-
cally corroborate the observations, we used an approach similar to Refs. [18,19]
and compared Kolmogorov-Smirnov statistics between the original degree data
and corresponding surrogate data. The value p then denotes the proportion of
surrogate datasets that have a worse fit (larger Kolmogorov-Smirnov distance)
than the original data. The results suggest that some of the compositions’ degree
distributions are consistent with a (truncated) power-law, but that others clearly
tend towards an exponential distribution. Fig. 3 shows two such examples (the
Prelude Ab Major exhibiting a power-law-like distribution, and the Fugue E mi-
nor a more exponential distribution). Other degree distributions (such as the one
corresponding to the largest network, the Fugue A minor) were neither consistent
with an power-law nor with an exponential (e.g. p < 0.1 in both cases).
266 F. Gomez, T. Lorimer, and R. Stoop

a) b)

d)
c)

e) f)

g) h)

Fig. 2. Networks corresponding to the compositions of Table 1. a) Prelude C Major,


b) Prelude C# Major, c) Prelude F minor, d) Prelude Ab Major, e) Fugue C minor,
f) Fugue E minor, g) Fugue A minor, and h) Fugue Bb minor.
Complex Networks of Harmonic Structure in Classical Music 267

a) b)
1.0 1.0

0.5 0.5

1.0 0.1 1.0


0.1
SF

SF
SF (k)

SF (k)
0.1
0.1

0.01

0.01
0.02 0.01
2 5 10 20 50 2 5 10 20
k k
2 3 5 7 10 20 2 3 5 7 10 20
degree k degree k

Fig. 3. Survival functions (SF (k) = 1 − P (k), with the cumulative distribution P (k))
for a) the unweighted Prelude Ab Major network, and b) the unweighted Fugue E minor
network. Fit (dashed line) corresponds in a) to a power-law fit (on the interval (2, kmax );
exponent 0.88), and in b) to an exponential fit (same interval; decay constant 0.12).
Insets: Same for weighted networks. Corresponding p-values (power-law/exponential):
a) 0.54/0.02 (weighted: 0.30/0.01), and b) 0.08/0.79 (weighted: 0.18/0.40).

Using the algorithm described in the methods section, we generated artifi-


cial polyphonic music for 1) the unweighted and undirected, 2) the weighted
and undirected, and 3) the weighted and directed networks. Typical examples
are available online [20]. As general observation, the music from the weighted
networks (2) sounds much more appealing than the music from the unweighted
networks (1). The step from the undirected (2) to the directed (3) case, however,
did usually not result in any further increase of appeal (rather the opposite).
Comparing the underlying compositions of the artificial music, a trend emerges:
whereas the music generated from most preludes’ networks sounds for many lis-
teners astonishingly pleasant and complex (see [20] for ‘good’ examples), the
fugues usually give rise to rather unstructured and unpleasant music. A direct
relation to the degree distribution, however, seems not to be evident.

4 Discussion and Conclusion

The approach we have taken here considers the immediate harmonic transi-
tions of a musical composition and represents them as a complex network. In
this way, salient characteristics of the evolution of a piece are captured (e.g.
a dominant-tonic-transition), but longer time-scales (higher-order transitions,
higher-level structures) are lost. Such higher-order transitions, which often exist
due to intermediate notes of a voice (or multiple voices), are especially present
in contrapuntal pieces, the most well-known of which are the fugues. While our
investigations have demonstrated that there still exists a musically meaningful
‘harmonic backbone’ in these fugues (the nodes with highest degree), the inde-
pendence of the voices in this truly polyphonic music renders any representation
of harmony difficult. This probably explains the difference between the artificial
268 F. Gomez, T. Lorimer, and R. Stoop

music generated from the preludes’ networks and the music generated from the
fugues’ networks.
The question of how to describe and quantify the complexity of music has
no clear answer. Different approaches can be taken, be they in the language
of mathematics, psychology, information theory or physics. Whereas any com-
plexity measure may provide the investigator with interesting insights into the
different compositions and styles of composing, a translation into the perceived
‘beauty’ or ‘appeal’ is inherently limited. Many listeners would judge Bach’s
contrapuntal music to be distinctly complex, and perceive Mozart’s or Haydn’s
music as more simple in the way it has been composed (which, however, does
certainly not rate Mozart’s or Haydn’s music below Bach’s music). Nevertheless,
and in spite of the subjectivity of ‘beauty’, there is considerable agreement on
which composers were ‘great’ and one may therefore still ask whether there are
any universal features that make music ‘beautiful’.
In physics, the natural objects to look for when talking about universality are
power-laws. A scale-free behavior of any attribute of musical compositions (be
it a rank-frequency plot or the degree distribution of a network) seems, in this
sense, obviously promising. Scale-free degree distributions of related (weighted)
networks were found both in classical and popular music ([4], and statistically
well-founded in the Supplementary Information of [5]). Whereas these studies
pooled over entire collections of musical pieces, we analyzed the degree distri-
butions of both the weighted and unweighted networks for single compositions.
As a result, we find that some distributions are indeed well-fit by a power-law,
but others clearly deviate and are much more consistent with an exponential.
We conclude that a scale-free distribution of harmonic transitions seems not to
be a prerequisite for ‘appealing’ musical compositions, but only a possibility.

Acknowledgments. This work was supported by the Swiss National Science


Foundation.

References

1. Watts, D.J., Strogatz, S.H.: Collective dynamics of ‘small-world’ networks. Na-


ture 393, 440–442 (1998)
2. Barabási, A., Albert, R.: Emergence of scaling in random networks. Science 286,
509–512 (1999)
3. Boccaletti, S., Latora, V., Moreno, Y., Chavez, M., Hwang, D.-U.: Complex net-
works: Structure and dynamics. Phys. Rep. 424, 175–308 (2006)
4. Liu, X.F., Tse, C.K., Small, M.: Complex network structure of musical composi-
tions: Algorithmic generation of appealing music. Physica A 389, 126–132 (2010)
5. Serrà, J., Corral, A., Boguñá, M., Haro, M., Arcos, J.L.: Measuring the Evolution
of Contemporary Western Popular Music. Sci. Rep. 2, 00521 (2012)
6. Liu, L., Wei, J., Zhang, H., Xin, J., Huang, J.: A Statistical Physics View of Pitch
Fluctuations in the Classical Music from Bach to Chopin: Evidence for Scaling.
PLoS ONE 8, e58710 (2013)
Complex Networks of Harmonic Structure in Classical Music 269

7. Zivic, P.H.R., Shifres, F., Cecchi, G.A.: Perceptual basis of evolving Western mu-
sical styles. Proc. Natl. Acad. Sci. U.S.A. 110, 10034–10038 (2013)
8. Nettheim, N.: On the Spectral Analysis of Melody. Interface 21, 135–148 (1992)
9. Boon, J.P., Decroly, O.: Dynamical Systems theory for music dynamics. Chaos 5,
501–508 (1995)
10. Voss, R.F., Clarke, C.: “1/f noise” in music: Music from 1/f noise. J. Acoust. Soc.
Am. 63, 258–263 (1978)
11. Bak, P., Tang, C., Wiesenfeld, K.: Self-organized criticality: an explanation of 1/f
noise. Phys. Rev. Lett. 59, 381–384 (1987)
12. Jennings, H.D., Ivanov, P.C., Martins, A.M., da Silva, P.C., Viswanathan, G.M.:
Variance fluctuations in nonstationary time series: A comparative study of music
genres. Physica A 336, 585–594 (2004)
13. Boon, J.P., Noullez, A., Mommen, C.: Complex Dynamics and Musical Structure.
Interface 19, 3–14 (1990)
14. Zanette, D.H.: Zipf’s law and the creation of musical context. Music Sci. 10, 3–18
(2006)
15. Beltrán del Rı́o, M., Cocho, G., Naumis, G.G.: Universality in the tail of musical
note rank distribution. Physica A 387, 5552–5560 (2008)
16. Lerdahl, F.: Tonal Pitch Space. Oxford University Press (2001)
17. Tymoczko, D.: The Geometry of Musical Chords. Science 313, 72–74 (2006)
18. Clauset, A., Shalizi, C.R., Newman, M.E.J.: Power-Law Distributions in Empirical
Data. SIAM Rev. 51, 661–703 (2009)
19. Deluca, A., Corral, Á.: Fitting and goodness-of-fit test of non-truncated and trun-
cated power-law distributions. Acta Geophys. 61, 1351–1394 (2013)
20. Artificially generated music is available on http://stoop.ini.uzh.ch/artmus

You might also like