Documente Academic
Documente Profesional
Documente Cultură
Abstract. In this paper we present two case studies for the application of the
technical computing software Mathematica in the domain of music creation and
music research. The first section describes an experimental interface for the
usage of random points, parametric curves and other mathematical objects in
the role of three-dimensional musical scores. Similar to the technology of the
old-fashioned player piano roles which encode any arbitrary piece for
mechanical player piano in three basic dimensions (onset, pitch, duration) we
provide an interface where a 3-dimensional score is created, visualized and
played. With this software the scores can be created with the assistance of a rich
arsenal of mathematical functions and also the sound of each single note can be
controlled in terms of mathematical functions. The aim of this software is the
creation of experimental musical pieces which explore the musical potential of
certain mathematical functions. In this paper we restrict ourselves to sketch the
interface. The more interesting aspects, namely the ‘musicality‘ of concrete
sonifications of certain mathematical objects, are subject to our live
demonstrations in Berlin.
In the second section we show how information theory may be used in the
analysis of musical scores and how specialized packages of the software
Mathematica may assist such investigations. As a particularly interesting topic
we describe the calculation of the transfer entropy between selected
instrumental parts in Beethoven symphonies.
T. Klouche and T. Noll (Eds.): MCM 2007, CCIS 37, pp. 441–448, 2009.
© Springer-Verlag Berlin Heidelberg 2009
442 C.W. Kulp and D. Schlingmann
consult Wolfram (2003) for all the information on Mathematica’s sound capabilities.
We will explore Mathematica’s high-level programming language, graphics
capabilities, and numerical and symbolical calculation tools to generate potentially
exciting music. We will present programs that create musical compositions based on
mathematical objects. The possibilities are endless for creating interesting and
intriguing music and sounds.
In a simplified way, music in the traditional sense is a collection of finite pitch
tones (frequencies) that are played at certain times for certain durations. A three-
dimensional point {x, y, z} could be interpreted as a tone that is played at time x
(measured in seconds), with frequency y (measured in Hz), for a duration z (measured
in seconds). In this fashion, a list of three-dimensional points represents a musical
composition. For example, the list of two three-dimensional points, {{0.6, 440.0,
1.5},{1.1, 554.365, 0.3}}, consists of two tones where the first tone is played after 0.6
seconds, with frequency 440.0 Hz, for 1.5 seconds, and the second tone is played after
1.1 seconds, with frequency 554.365 Hz, for 0.3 seconds. The Mathematica command
to play such a sound is: Play[Piecewise[{{Sin[440.0*2*π*t], (t >= 0.6) && (t <=
0.6+1.5)}}]+Piecewise[{{Sin[554.365*2*π*t], (t >= 1.1) && (t <= 1.1+0.3)}}], {t, 0,
2.1}], where Piecewise[{{val1, cond1},{val2, cond2}, …}] represents a piecewise
function with values vali in the regions defined by the conditions condi Wolfram
(2003). If none of the conditions condi apply, the default value is 0.
Based on the above Mathematica command, we will introduce a program called
createMusic, written by Schlingmann (see Kulp, Machado and Schlingmann 2007),
that takes any finite list of three-dimensional points, like the one mentioned in the
previous paragraph, as input and turns it into a musical composition as described
above. Of course, we might need to scale the coordinates of the three-dimensional
points to reasonable values so that times (when tones are played), frequencies, and
durations are in acceptable ranges. For example, we do not want to include negative
durations or frequencies outside the range of human hearing. In the process of using
the program createMusic, a three-dimensional graph of the scaled three-dimensional
points will also be displayed (see Figure 1). This graph can serve as a visualization of
the musical composition. We apply createMusic to data that originates from random
points, parametric curves, sequences, or a variety of other mathematical objects.
S = {s1 s2 s 3 s N },
where the element, si , represents the measurement of the physical quantity, S, taken at
time (i – 1) Δt. There exists a large literature on extracting information about a
system by performing calculations on time series measurements taken from the
system (Kantz and Schreiber 2004; Abarbanel 1996; and references therein). By
applying time series analysis methods to musical compositions, we hope to be able to
learn more about specific compositions as well as demonstrate quantitatively the
differences and similarities between compositions and composers. One of the long-
term goals of this project is to be able to use time series analysis to classify
compositions by composer without having to hear the piece.
The application of time series calculations on musical compositions is not new. In
Monroe and Pressing (1998) and Reiss and Sandler (2003), time series were generated
from a digital recording of various compositions. In particular, the authors of Monroe
and Pressing (1998) and Reiss and Sandler (2003) focused on phase space
reconstruction and the estimation of Lyapunov exponents. Estimation of the Lyapunov
exponent is typically done to determine whether or not a system is chaotic. In this
paper, we will not use recordings of Beethoven’s symphonies to generate our time
series; instead we will use the sheet music of the symphony. Furthermore, we will
focus on estimating the rate of information transfer between instruments as a means of
illustrating the relationships between string instruments in Beethoven’s symphonies.
We begin by demonstrating how to create a time series from sheet music. Consider
the measure shown in Figure 2.
444 C.W. Kulp and D. Schlingmann
Fig. 2. A sample measure which was used to create the time series that appears below
We begin this section with a non-musical example. Suppose one were to measure the
amount of rainfall in the Gulf of Mexico and the average price of gasoline in the United
States each week for a period of ten years. By doing this, the observer has produced two
time series, one for rainfall and one for the price of gasoline. A natural question to ask
is, based on our data, does the amount of rainfall in the Gulf of Mexico influence the
price of gasoline in the United States? Time series analysis provides a means of
answering this question through the transfer entropy calculation (Schreiber 2000).
The transfer entropy measures the amount of information exchanged between two
systems based on their time series measurements. Consider two time series, X and Y,
each measured from a different (but possibly related) system. The transfer entropy
between the two systems can be computed using the equation below.
§ p ( x n +1 | x n , y n ) ·
T (Y → X ) = ¦ p ( x n +1 , x n , y n ) Log 2 ¨¨ ¸¸
© p ( x n +1 | x n ) ¹
§ p ( y n +1 | x n , y n ) ·
T ( X → Y ) = ¦ p ( y n +1 , x n , y n ) Log 2 ¨¨ ¸¸
© p ( y n +1 | y n ) ¹
The summation is over all possible elements in the time series. The base-two
logarithm gives a unit of bits for the transfer entropy. Hence, if T(X Æ Y) = 0.01 and
T(Y Æ X) = 0.1, then we say that Y more strongly influences X than vice-versa. The
function, p, is the probability that an element or set of elements occurs in the time
series. For example, the function, p(xn+1 = 1, xn = 1, yn = 0), would give the
probability of a 1 occurring in X one time-step after a 1 is measured in X and a 0 is
measured in Y. For a Mathematica algorithm which computes the transfer entropy,
the interested reader should consult Kulp, Machado and Schlingmann (2007).
Fig. 3. The transfer entropy analysis of the string section of Beethoven’s First Symphony. Note
the change in notation, T(A,B) = T(A Æ B). Further note that: V1 = first violin, V2 = second
violin, V = viola, C = cello, and B = bass.
Fig. 4. The transfer entropy analysis of the string section of Beethoven’s Fifth Symphony. Note
the change in notation, T(A,B) = T(A Æ B). Further note that: V1 = first violin, V2 = second
violin, V = viola, C = cello, and B = bass.
Using Mathematica to Compose Music and Analyze Music with Information Theory 447
Fig. 5. The transfer entropy analysis of the string section of Beethoven’s Sixth Symphony. Note
the change in notation, T(A,B) = T(A Æ B). Further note that: V1 = first violin, V2 = second
violin, V = viola, C = cello, and B = bass.
448 C.W. Kulp and D. Schlingmann
this project. It is also important to mention that any attempt to quantify a composer’s
style using time series will most likely include several other analyses. However, we
believe that the transfer entropy will be an important piece of the overall all
quantitative analysis of a composer’s style of composition.
3 Conclusions
Mathematica can be used to generate interesting music based on data sets and
mathematical curves as shown above. Time series analysis provides a powerful tool
with which we can learn more about musical compositions. By using the transfer
entropy we can identify relationships between instruments in a symphony. By
studying how these relationships change from one symphony to the next, we may be
able to quantify how the style of a composer changes during his or her lifetime. With
more extensive studies, it may even be possible to identify the composer of a piece of
music of which little is known.
References
Abarbanel, H.D.I.: Analysis of Observed Chaotic Data. Springer, New York (1996)
Daw, C.S., Finney, C., Tracy, E.: A review of symbolic analysis of experimental data. Review
of Scientific Instruments 72, 915–930 (2003)
Kantz, H., Schreiber, T.: Nonlinear Time Series Analysis, 2nd edn. Cambridge, London (2004)
Kulp, C., Machado, M., Schlingmann, D.: Composition and Analysis of Music Using
Mathematica. Mathematica in Education and Research 12, 1–20 (2007)
Monro, G., Pressing, J.: Sound visualization using embedding: The art and science of auditory
correlation. Computer Music Journal 22, 20–34 (1998)
Reiss, J.D., Sandler, M.B.: Nonlinear Time Series Analysis of Musical Signals. In: Proc. on the
6th Intl. Conference on Digital Audio Effects (DAFX 2003), London, United Kingdom,
September 8-11 (2003)
Schreiber, T.: Measuring Information Transfer. Physical Review Letters 85, 461–464 (2000)
Shannon, C.E.: A Mathematical Theory of Communication. The Bell System Technical
Journal 27, 379–423 (1948)
Wolfram, S.: The Mathematica Book, 5th edn. Wolfram Media, Inc., Champaign (2003)