Algorithmic melody composition based
on fractal geometry of music
Dmitri Kartofelev, Juri Engelbrecht
Institute of Cybernetics at Tallinn University of Technology,
Centre for Nonlinear Studies (CENS),
Tallinn, Estonia
August 13, 2013
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
1 / 27
Brief history of fractal music
570 BCE Pythagoras believed that numbers are the
source of music.
1026 Guido dArezzo created algorithmic music.
1815 - 52 Ada Lovelace worked with Charles Babbage
the creator of the first programmable
computer (difference engine).
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
2 / 27
Brief history of fractal music
570 BCE Pythagoras believed that numbers are the
source of music.
1026 Guido dArezzo created algorithmic music.
1815 - 52 Ada Lovelace worked with Charles Babbage
the creator of the first programmable
computer (difference engine).
Supposing, for instance, that the fundamental relations of pitched
sound in the signs of harmony and of musical composition were
susceptible of such expression and adaptations, the engine might
compose elaborate and scientific pieces of music of any degree of
complexity or extent. Ada Lovelaces notes 1851
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
2 / 27
Self-similarity of music
Figure: Scores of Bachs inventions no. 1 and 10. right hand,
left hand. Fractal reduction of Bachs invention no. 1. The 1/2,
1/4. 1/8, 1/16, 1/32 reductions of the scores, respectively.
1
K. J. Hs
u, A. Hs
u, Self-similarity of the 1/f noise called
music, Proc. Natl. Acad. Sci., vol. 88, pp. 35073509, 1991.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
3 / 27
Fractal geometry of musical scores
Note interval i fluctuations
12
fn+1 = 2 fn
12
f (i) = 2i
(1)
(2)
K. J. Hs
u, A. Hs
u, Fractal geometry of music, Proc.
Natl. Acad. Sci., vol. 87, pp. 938941, 1990.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
4 / 27
Fractal geometry of musical scores
Note interval i fluctuations
12
fn+1 = 2 fn
12
f (i) = 2i
(1)
(2)
Occurrence frequency of interval i
follows the inverse power law:
f (i) =
c
iD
log(f ) = C D log(i)
(3)
Figure: Fractal geometry of
(4) note frequency. Bach BWV
772.
K. J. Hs
u, A. Hs
u, Fractal geometry of music, Proc.
Natl. Acad. Sci., vol. 87, pp. 938941, 1990.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
4 / 27
Fractal geometry of loudness fluctuations 3
Figure: Loudness fluctuation spectra for a) Scott Joplin Piano Rags,
b) classical radio station, c) rock station, d) news and talk station.
3
R. V. Voss and J. Clarke, 1/f noise in music and speech,
Nature, vol. 258, pp. 317318, 1975.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
5 / 27
Fractal geometry of pitch fluctuations
Figure:
Pitch fluctuation spectra for
a) classical, b) jazz, blues, c) rock, d) news
and talk radio station.
4 5
Figure:
Left: a) Babenzele Pygmies b) Japanese traditional c) Indian classical.
d) Russian folklore e) USA blues Right: a) Medieval music b) Beethovens 3.
symphony c) Debussy piano d) Strauss, Ein Heldenleben e) The Beatles, Stage Pepper
R. V. Voss and J. Clarke, 1/f noise in music and speech, Nature,
vol. 258, pp. 317318, 1975.
5
K. J. Hs
u, Applications of fractals and chaos, SpringerVerlag, pp. 2139, 1993.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
6 / 27
Fractal geometry of musical rhythm
Figure: The 1/f D rhythm spectra are ubiquitous across genres.
Analysis of 558 compositions spanning over a period of 4 centuries.
6
D. J. Levitina, P. Chordiab, and V. Menonc, Musical rhythm spectra
from Bach to Joplin obey a 1/f power law, PNAS, vol. 109,
no. 10, pp. 37163720, 2012.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
7 / 27
Music as fractal
All components of human composed music (melody,
harmony, rhythm, loudness) have a fractal geometry.
Fractal dimension D of musical time series can have
values in the interval (0.5, 2).7
Fractal geometry of human music can be exploited
for the purpose of the algorithmic music
composition.
7
M. Bigerelle, A. Iost, Fractal dimension and classification of
music, Chaos, Solitons and Fractals, vol. 11, pp. 21792192,
2000.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
8 / 27
Fractal music composition: main idea
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
9 / 27
Fractal music composition: main idea
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
9 / 27
Fractal music composition: main idea
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
9 / 27
Fractal music composition: main idea
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
9 / 27
Logistic map
Logistic map is in the form
yn+1 = ryn (1 yn ),
(5)
where r is parameter that has
values in the interval (0, 4]
Figure: Logistic map, where
y0 = 0.1 and r = 3.71
Audio example of the logistic map (15 s)
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
10 / 27
1/f noise generator (pink noise)
1/f noise generator is in the form
p
yn+1 = myn + k 1 m2 , (6)
where m is in the interval [0, 1]
and k is random number.
For music generation value of k is
taken from logistic map, where
Figure: 1/f noise where
parameter r = 4.
x0 = 0.1 and m = 0.7
Audio example of the pink noise generator (15 s)
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
11 / 27
Lorenz fractal
Lorenz fractal is in the form
yn+1 = a(3yn 4yn3 ),
(7)
where parameter a is in the
interval [0, 1].
For the music generation best
vales of the parameter a are
[0.65, 1].
Figure: Lorenz fractal where
a = 0.97 and y0 = 0.1
Audio example of the Lorenz fractal (15 s)
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
12 / 27
Henoni fraktal
Henon fractal is in the form
(
xn+1 = 1 + yn ax2n
(8)
yn+1 = bxn
For music generation, a = 1.4
and b = 0.3
Figure: Henon fractal
where a = 1.4, b = 0.3,
x0 = y0 = 1, 104 iterations
Audio example of the Henon fractal (15 s)
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
13 / 27
Hopalongi fraktal
Hopalong fractal is in the form
(
p
xn+1 = yn sgn xn |bxn c|
yn+1 = a xn ,
(9)
where a, b ja c are the control
parameters.
Figure: Hopalong fractal
where a = 55, b = 17,
c = 21, x0 = y0 = 0,
5 104 iterations
Audio example of the Hopalong fractal (15 s)
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
14 / 27
Gingerbread man fractal
Gingerbread man fractal is in the
form
(
xn+1 = 1 yn + |xn |
(10)
yn+1 = xn
For music generation we select
x0 = 0.1 and y0 = 0.
Figure: Gingerbread man
fractal where x0 = 0.1,
y0 = 0, 5 104 iterations
Audio example of the gingerbread man fractal (15 s)
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
15 / 27
L-system (Lindenmayer system)
Formal grammar developed by Aristid Lindenmayer.
Rules: P1: a ab
P2: b a
Axiom: b
n=0:
n=1:
n=2:
n=3:
n=4:
n=5:
b
a
ab
aba
abaab
abaababa
Figure: Interpretation:
a = 0.2 and b = 0.2
Audio example of the L-system fractal (15 s)
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
16 / 27
Other musical fractals: Popcorn fractal
(
xn+1 = xn h sin(yn + tan 3yn )
yn+1 = yn h sin(xn + tan 3xn )
(11)
Figure: Popcorn fractal where h = 0.05, x0 = 0.1, y0 = 0, 5 104
iterations.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
17 / 27
Other musical fractals: Quadrup-Two
(
xn+1 = yn sgn xn sin(ln |b(xn c)|) tan1 |c(xn b)|2
yn+1 = a xn
(12)
Figure: Quadrup-Two fractal where a = 50, b = 1, c = 41,
x0 = 1, y0 = 1, 5 104 iterations
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
18 / 27
Other musical fractals: Mira fractal
2(1a)x2n
1+x2n
2(1a)x2
axn+1 + 1+x2 n+1
n+1
(
xn+1 = byn + axn +
yn+1 = xn +
(13)
Figure: Mira fractal where a = 0.31, b = 1, x0 = 12, y0 = 0, 5 104
iterations
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
19 / 27
Other musical fractals: Hopalong 2 fractal
(
xn+1 = yn + sgn xn |bxn c|
yn+1 = a xn
(14)
Figure: Hopalong 2 fractal where a = 0.6, b = 1.5, c = 2.5,
x0 = y0 = 1, 5 104 iterations
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
20 / 27
Other musical fractals: Hopalong 3 fractal
(
p
xn+1 = yn sgn xn |xn sin a cos a|
yn+1 = a xn
(15)
Figure: Hopalong 3 fractal where a = 26, x0 = y0 = 0, 5 104
iterations
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
21 / 27
Examples of fractal music
Using aforementioned knowledge and methods the engine
(computer) might compose elaborate and scientific
pieces of music of any degree of complexity or extent.
Example composition no. 1 (duration 40 s)
Example composition no. 2 (duration 40 s)
Example composition no. 3 (duration 40 s)
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
22 / 27
Why it works? (possible connections)
Natural phenomena, Richardson Effect.8
K. J. Hs
u, 1983.
Y. Yu, R. Romero, and T. S. Lee, 2005.
10
M. A. Schmuckler, D. L. Gilden, 1993.
11
T. Musha, 1997.
9
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
23 / 27
Why it works? (possible connections)
Natural phenomena, Richardson Effect.8
On the level of neurons, human brain resonates
more, with self-similar stimulus (especially 1/f
noise).9 10
K. J. Hs
u, 1983.
Y. Yu, R. Romero, and T. S. Lee, 2005.
10
M. A. Schmuckler, D. L. Gilden, 1993.
11
T. Musha, 1997.
9
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
23 / 27
Why it works? (possible connections)
Natural phenomena, Richardson Effect.8
On the level of neurons, human brain resonates
more, with self-similar stimulus (especially 1/f
noise).9 10
Human behaviour (clapping of hands).11
K. J. Hs
u, 1983.
Y. Yu, R. Romero, and T. S. Lee, 2005.
10
M. A. Schmuckler, D. L. Gilden, 1993.
11
T. Musha, 1997.
9
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
23 / 27
Why it works? (possible connections)
Natural phenomena, Richardson Effect.8
On the level of neurons, human brain resonates
more, with self-similar stimulus (especially 1/f
noise).9 10
Human behaviour (clapping of hands).11
Biological processes (heart rate fluctuations, pupil
diameter and focal accommodation, instantaneous
period fluctuations of the organ Alpha-rhythms,
self-discharge and action potential impulses of
neurons, etc.).11
8
K. J. Hs
u, 1983.
Y. Yu, R. Romero, and T. S. Lee, 2005.
10
M. A. Schmuckler, D. L. Gilden, 1993.
11
T. Musha, 1997.
9
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
23 / 27
Why it works? (possible connections)
Self-similarity on different scales. Social behaviour.
Figure: Ba-Ila fractal village plan.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
24 / 27
Conclusions
Music composed by humans has a fractal geometry
(can be described by a fractional dimension).
Main ideas and methods behind the fractal and
algorithmic music composition were presented.
Some examples of the musical fractals where
presented and discussed.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
25 / 27
References
B. B. Mandelbrot, The Fractal Geometry of Nature, W. H. Freeman and Company,
New York, 1982.
K. J. Hs
u and A. Hs
u, Self-similarity of the 1/f noise called music, Proc. Natl.
Acad. Sci., vol. 88, pp. 35073509, 1991.
K. J. Hs
u and A. Hs
u, Fractal geometry of music, Proc. Natl. Acad. Sci., vol. 87,
pp. 938941, 1990.
K. J. Hs
u, Applications of fractals and chaos, Springer-Verlag, pp. 2139, 1993.
D. J. Levitina, P. Chordiab, and V. Menonc, Musical rhythm spectra from Bach to
Joplin obey a 1/f power law, PNAS, vol. 109, no. 10, pp. 37163720, 2012.
M. Bigerelle and A. Iost, Fractal dimension and classification of music, Chaos,
Solitons and Fractals, vol. 11, pp. 21792192, 2000.
N. Nettheim, On the spectral analysis of melody, Journal of New Music Research,
vol. 21, pp. 135148, 1992.
R. V. Voss and J. Clarke, 1/f noise in music and speech, Nature, vol. 258, pp.
317318, 1975.
M. A. Kaliakatsos-Papakostas, A. Floros, and M. N. Vrahatis, Music Synthesis Based
on Nonlinear Dynamics, In proceedings of Bridges 2012: Mathematics, Music, Art,
Architecture, Culture, July 25-29, Baltimore, USA, pp. 467470, 2012.
A. E. Coca, G. O. Tost, and L. Zhao, Characterizing chaotic melodies in automatic
music composition, Chaos: An Interdisciplinary Journal of Nonlinear Science, vol. 20,
no. 3, pp. 033125-1033125-12, 2010.
A. Alpern (1995), Techniques for algorithmic composition of music, Hampshire
College.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
26 / 27
References
K. J. Hs
u, Actualistic Catastrophism: Address of the retiring President of the
International Association of Sedimentologists, Sedimentology, vol. 30, no. 1, pp.
39, 1983.
Y. Yu, R. Romero, and T. S. Lee, Preference of sensory neural coding for 1/f
signals, Phys. Rev. Lett., vol. 94, pp. 108103-2108103-4, 2005.
J. Jeong, M. K. Joung, S. Y. Kim Quantification of emotion by nonlinear analysis of
the chaotic dynamics of electroencephalograms during perception of 1/f music, Biol.
Cybern., vol. 78, pp. 217225, 1998.
Grout, Donald Jay & Claude V. Palisca (1996), A History of Western Music, 5th ed.
W. W. Norton and Company: New York
P. Prusinkiewicz (1986) Score Generation with L-systems, Proc. Intl. Computer
Music Conf 86, 455-457
Stelios Manousakis (2006,) Musical L-systems MSc thesis - sonology, The Royal
Conservatory, The Hague
John A. Maurer IV (1999), A Brief History of Algorithmic Composition
A.J. Crilly, Rae A. Earnshaw, Huw Jones (Editors) (1993), Applications of Fractals
and Chaos: The Shape of Things, Springer
P. C. Ivanov, From 1/f noise to multifractal cascades in heartbeat dynamics, Chaous
vol. 11, no. 3, pp. 641-652, 2001.
T. Musha, 1/f fluctuations in biological systems, In Proceedings - 19th International
Conference - IEEE/EMBS Oct. 30 - Nov. 2, 1997 Chicago, IL. USA, pp. 2692-2697
M. A. Schmuckler, D. L. Gilden, Auditory Perception of Fractal Contours, Journal
of Experimental Psychology: Human Perception and Performance,
Vol. 19, No. 3. pp. 641-660, 1993.
Dmitri Kartofelev, J
uri Engelbrecht (CENS)
FUDoM 13
August 13, 2013
27 / 27