Evolutionary Methods for Melodic Sequences Generation
from Non-Linear Dynamic Systems
Eleonora Bilotta1, Pietro Pantano2, Enrico Cupellini3, Costantino Rizzuti1
Department of Linguistics, University of Calabria, Cubo 17b Via P. Bucci,
Arcavacata di Rende (CS) 87036, Italy
bilotta@unical.it
cosriz@yahoo.it
2 Department of Mathematics, University of Calabria, Cubo 30b Via P. Bucci,
Arcavacata di Rende (CS) 87036, Italy
piepa@unical.it
3 Department of Mathematics, University of Torino, Via Carlo Alberto 10,
Torino 10123, Italy
cupellini@dm.unito.it
1
Abstract. The work concerns using evolutionary methods to evolve melodic
sequences, obtained through a music generative approach from Chua s circuit, a
non-linear dynamic system, universal paradigm for studying chaos. The main
idea was to investigate how to turn potential aesthetical musical forms,
generated by chaotic attractors, in melodic patterns, according to the western
musical tradition. A single attractor was chosen from the extended gallery of the
Chua s dynamical systems. A specific codification scheme was used to map the
attractor s space of phases into the musical pitch domain. A genetic algorithm
was used to search throughout all possible solutions in the space of the
attractor s parameters. Musical patterns were selected by a suitable fitness
function. Experimental data show a progressive increase of the fitness values.
Keywords: Chua s Attractor, Genetic Algorithm, Generative Music.
1 Introduction
Mathematics and Music are strictly tied since the early foundation of Western
culture. Since 80s, chaos and fractal geometry have strongly affected the development
of a new field of musical research, with the use of non-linear dynamic systems for
artistic purpose. Many musical researchers tried using non-linear dynamical systems
as melodic pattern generators, able to generate variation or pa raphrase like alteration
of specified groups of events [1]. Bidlack [2] says that chaos is of potential interest
to composers who work whit computers, because it offers a mean of endowing
computer-generated music with certain natural qualities not attainable by other
means . According to Harley [3], non-linear functions and Music exhi bit a
comparable degree of self-similarity or autocorrelation.
Lately, modern researches on complexity use sounds and Music trying to develop
new methods supporting traditional mathematical ways in understanding emerging
behaviours in complex and chaotic systems. In these years Rodet [4] used Chua s
circuit for sound modeling, due to its non-periodical components; Bilotta et al. [5]
used the same circuit for producing melodies.
In the following paragraphs we show how evolutionary methods could be used in
order to manage the problems related to generative creation of music. Evolutionary
music is a growing discipline that reached surprising successes. Khalifa, and Foster
[6], for example, made a composition tool using Genetic Algorithms that generate and
combine musical patterns with two fitness functions based on melodic intervals and
tonal ratios.
The paper is organized as follows: Section 2 presents Chua s c ircuit and its
attractors, describing also the codification process we used. Section 3 explains the
Genetic Algorithm and fitness function formal aspects. Section 4 reports about the
experimental results and musical analysis of these findings. Section 5 concludes the
paper illustrating new directions of this work.
2 Chaos and generative music
2.1 Chua s oscillator
Chua s oscillator is a non-linear circuit exhibiting a chaotic dynami cal behaviour
which provides a great family of strange attractors [7, 8]. Chua s circuit is a
dynamical system with three grades of freedom and six control parameters:
α , β , γ , a, b, k ; its dimensionless equations are:
.
x = kα [ y − x − f ( x)]
(7)
.
(7)
.
(7)
y = k ( x − y + z)
z = k (− β y − γ z )
where:
f ( x) = bx +
1
( a − b){| x + 1 | − | x − 1 |}
2
(7)
In the initial part of this research we chose to focus our attention on one of the
most famous Chua s attractor: the double scroll pattern (Figure 1). Table 1 shows the
control parameter s values of this system.
Fig. 2. Three-dimensional graphic of Chua s double scroll attractor in the space of phases.
Table 3. Control parameters and initial values for the Chua s double scroll.
α= 9,3515908493
a = -1,1384111956
β= 14,7903198054
b = -0,7224511209
γ = 0,0160739649
k=1
2.2 Musical codification
Generative music is based on two separate processes: an algorithm generating
numerical sequences and a process for translating these sequences into melodic
patterns. Since the coding process, also called musification, can be realized in a
completely arbitrary manner, it is obvious that the quality of the musical rendering
depends substantially on the choices which have been made. For this reasons, in
defining a codification scheme, it s important to try realizi ng not only a mechanism
that allows for a simple translation between numerical sequences and musical
parameters, but also a codification system allowing for a meaningful transformations
preserving the main characteristics of the system s main fe atures in order to exploit,
from a musical point of view, the potentials dynamical systems have (fractal nature,
different kind of behaviour and so on).
At the first stage we was concerned in defining a codification system to associate
the solution x(t), y(t), z(t) of the system to a succession of musical notes Sk:
Sk = {note1, note2, note3, ..., notek}.
(7)
We have used a simplified codification scheme taking into account only the pitch
parameter. Using a linear mapping (Figure 2) we translated into musical pitches,
according to the MIDI protocol, the X-axis coordinate in the space of phases (see
Figure 1). Moreover we chose to create a new MIDI note every time the waveform,
ti m e
related to the evolution of the X coordinate in the space of phases, reaches a
maximum or a minimum point. Figure 2 shows a graphic schematisation of the used
musical mapping; this kind of musical code can reveal, through the melodic pattern,
some topological information about the dynamical system behaviour.
Fig. 2. Graphic schematisation of the musification process. The linear mapping transforms
the numerical values of the attractor waveform in musical pitches.
3 Evolutionary process.
In order to solve some of the problems related to the musification process, our
system adopts a Genetic Algorithm (GA) search strategy to select melodic sequences
obtained through a music generative approach. GAs are often cited as appropriate for
exploring high dimensional parameter spaces as large regions of problems space can
be covered quickly. Bilotta et al. [9] also presented a method based on a Genetic
Algorithm to produce automatic music developing a fitness function based on
consonance, which allows evaluating the pleasantness of a sequence
of notes
generated by an algorithm. In this work we chose to use the parameters (
α , β , γ , a, b ) of the Chua s oscillator as a genotype and the melodic patterns,
produced by mapping the X coordinate of the space of phases in a sequence of MIDI
events, as phenotype. Table 2 shows the range in which every parameter can be
varied:
Table 3. Range of parameters defining the searching space. These intervals were chosen to
maintain the attractor s stability changing only one parameter a time. However changing more
parameters at the same time the system s divergence from the double scrolling attractor (over
flow) can occur.
8.80< α<9.73
14.10< β <15.08
-0.04< γ <0,10
-2.90<a<-1.09
-0.87<b<-0.62
In order to explain how the GA works, we ll give some formal definition.
Let κ={ α , β , γ , a, b } be a genotype related to a specific configuration of the
attractor of the Chua s oscillator; we can define an initial population Pκ(0) of random
generated genotypes in the searching space.
The GA scheme can be written as:
1.
∀ κ ∈ PΚ(i ) calculates the melodic pattern related to the attractor;
2.
3.
∀ κ ∈ PΚ(i ) calculates the fitness value;
generates new genotype starting from the fittest genotype of the previous
generation by applying crossing over, mutation and random generation;
( i + 1)
4. builds PΚ
and make it the current generation;
5. goes to 1.
This cycle is iterated until a fixed number of generations have been evolved.
3.1 Fitness functions
The aim of the fitness function is to realize an automatic selection of the melodic
patterns generated by the Chua s oscillator.
Let us suppose that a generative process has produced a sequence of n notes which
we can group in a set X:
X={x1,x2,& & .,xn}
(7)
If we assign to the lower C, belonging to the same octave the notes in X the label
index 1, and the following C# the label index 2 and so on until the note B, then we can
define a set J of n indexes in the range (1-12) belonging to the notes in X.
We can define a fitness function which calculates the fitness value for the set of
notes X as sum of all scores related to each melodic interval in the pattern:
f( J ) =
(7)
n
∑
i= 1
cJ i J i+ 1
Let us associate to each coefficient of the matrix shown in table 3 a constant value,
c
the J i J k coefficient represents the consonance score of the melodic interval xi-xk this
value has been chosen according with aesthetic consideration about the melodic
patterns we would to obtain from the evolutionary process. Let us call the obtained
matrix C.
Coefficients of the C matrix must be chosen very carefully and some of them have
to be negative; it becomes very clear that by choosing suitable values for the
coefficients of the score matrix, consonant and dissonant melodic intervals, unison,
chromatic or diatonic intervals can be discouraged or encouraged.
We used three different score matrices for separated evolutionary runs.
The first score matrix was based on consonance of successive tones:
Intervals of 3th, 6th, 4th , 5th , in the C major key, received a valuation of 2000.
Intervals of 2 th, 7 th, 8 th or unison in the C major key received a valuation of 100.
Intervals containing one note out of key (C#,D#,& ) received a valuation of 100.
Intervals containing two notes out of key received a valuation of 1000.
Table 3. The first score matrix C.
The second score matrix is also based on consonance, but it s more selective
because we have chosen score to widely discourage notes out of the chosen key.
Intervals of 3th and 6th, perfect 4th , 5th , in the C major key received a positive valuation
of 20.
Intervals of 2th,7th,8th or unison in the C major key received negative valuation of -1.
Every interval containing at least one note outside C major key received a negative
valuation of -20.
Third score matrix only valuated if the notes belonged to the C major key, with a
consequent positive or negative value (±2).
4 Results
All the experiments have been set up with a population of 40 elements, each one
evolved for 100 time steps. From the selection process the 10 fittest melodies form the
élite. To obtain the next generation we use:
-
ten elements of the previous élite group;
twenty elements obtained by crossing-over the elements of the élite with a
random mutation of one gene;
ten elements from a new random creation in the parameters space.
We have conducted experiments using the three score matrices above mentioned.
The experimental results show that the genetic algorithms allows obtaining a best
fitness values constantly increasing. In Figure 3 the graphics sketch the results of one
run for each score matrix; graphs show the best and the mean normalized values of
the fitness function.
Fig. 3. Left: Results of the evolutionary run using the first score matrix. Center: Results of
the evolutionary run using the second score matrix. Right: Results of the evolutionary run using
the third score matrix
Attractors of the first evolutionary process didn t reach the best values instead of
others, probably because they were not properly selected. In fact, while first score
matrix didn t evaluate negatively occasional notes out of the select ed key,
alternatively it gave a strong penalty to the passages between two pitches out of key.
4.1 Musical analysis
Musical analysis for the first score matrix reveals the presence of short melodic
patterns with a deviating contour (Figure 4). There are dissonant intervals even at
early fragments of the melodies, that carry the listener out of tonality. Apparently the
musical patterns seem to present a repetition of some parts of the entire structure,
which manifests the fractal nature of the generating system.
Fig. 4. Piano roll representation of the melodic pattern obtained by an evolutionary
experiment using the first score matrix.
The second score matrix caused longer melodic patterns (Figure 5). The orbit
spends more time on a single attractor s lobe and then it scroll s to the other lobe. At
least in the early sections of melodies there are consonant passages, and the melodic
deviations can be heard like implicit harmonic progressions.
Fig. 5. Piano roll representation of the melodic pattern obtained by an evolutionary
experiment using the second score matrix.
Third score matrix didn t evaluate melodic intervals, it only e valuated if the notes
belonged to the C major key (Figure 6). The attractors which produce these musical
patterns were often narrow and their melodies were made of the same repeated
pitches. Changes in melody pitches follow the scrolling movement of the orbit around
a limit cycle. The musical effect is poorer but every pitch is in the C major key, so
with different mapping range it could be possible to obtain different melodic jumps in
the same key.
Fig. 6. Piano roll representation of the melodic pattern obtained by an evolutionary
experiment using the third score matrix.
5 Discussion and further progress.
In this paper we presented a preliminary study about how to use Chua s circui t as a
melodic generator of tonal sequences and Genetic Algorithms for searching out
possible musical proportions in one specified attractor. The chosen musical
codification, with a fitness function based on tonal progression have produced some
interesting results. Two of the three selected score matrices led to melodies whose
pitches were not every included in C major key. These findings suggest that not only
the fitness function is important to make tonal progressions, using a pre-existing
dynamical system, but it must be considered also the mapping range and maybe other
musical codifications. In future works, we will try to operate a co-evolution of
attractor s parameters and mapping extension. We are also inte rested in comparing
melodic sequences from different coordinate in Chua s attractors space o f phases, like
Y and Z axes. Future developments of this work will use the evolutionary methods in
order to evolve rhythmic and dynamic patterns selection.
Reference
1. Pressing, J., Nonlinear Maps as Generators of Musical Design. Computer Music Journal,
Vol. 12, No 2 Summer 1988, MIT, (1988), 35-45.
2. Bidlack, R. Chaotic systems as Simple (but Complex) Compositional Algorithms. Computer
Music Journal, Vol. 16, No 3, MIT, (1992), 33-47.
3. Harley, J., Generative Processes in Algorithmic Composition: Chaos and Music. Leonardo,
Vol 28, No 3, (1995), 221-224.
4. Rodet, X., Vergez, C., Nonlinear Dynamics in Physical Models: Simple Feedback-Loop
Systems and Properties. Computer Music Journal, 23:3, MIT, (1999), 18-34.
5. Bilotta, E., Pantano, P., Gervasi S., Readings Complexity in CHUA's Oscillator Through
Music. Part I: A New Way Of Understanding Chaos. International Journal of Biforcation
and Chaos, Vol.15, No. 2, (2005), 253-382.
6. Khalifa, Y., Foster, R., A two-state autonomous evolutionary music composer.
EvoWorkshops (2006), 717-721.
7. Chua, L.O., Wu, C. W., Huang, A. & Zhong, G. Q., A universal circuit for studying and
generating chaos. I. Routes to chaos. IEEE Trans. Circuits. Syst.-I: Fundam. Th. Appl. 40,
(1993a), 732-744.
8. Chua, L.O., Wu, C. W., Huang, A. & Zhong, G. Q., A universal circuit for studying and
generating chaos. II. Strange attractors. IEEE Trans. Circuits. Syst.-I: Fundam. Th. Appl.
40, (1993b), 745-761.
9. Bilotta, E., Pantano, P., Talarico, V., Evolutionary Music and Fitness Function, in A.M.
Anile, V. Capasso, A. Greco editors, Mathmatics in Industry 1, Progress in Industrial
Mathematics at ECMI, Springer, (2000), 127-139.