Sei sulla pagina 1di 30

Evolutionary Music Composition

Martin Dostal

Abstract. Evolutionary music composition refers to machine-based generation of


musical pieces by means of evolutionary computation techniques. In this chapter we discuss machine-based music composition from several viewpoints. First,
techniques used to machine-based music composition are reviewed. Second, music composition subtasks, such as generating melodies, harmonization of musical
phrases and generating rhythm patterns or composition of a rhythm accompaniment
are introduced. Third, two distinct approaches to the evaluation of generated music are discussed: interactive evaluation based on human mentors judgement and
autonomous evaluation of generated musical material by the system itself. The rest
of the chapter describes six recognized evolutionary systems for music composition in detail. In particular, the description is focused to the design of evolutionary
algorithms behind these systems.

1 Introduction
Evolutionary techniques have attained high popularity in machine learning and optimization. These techniques have a wide body of applications including less conventional areas such as machine-based creating of (art)works. However, the term artwork may seem as overstatement, depending on your definition on what an artwork
really is, so we can use rather the term machine creativity for machine generated
paintings, music or poetry.
In this book chapter we discuss machine-based generation of music using evolutionary techniques. We assume that the reader is at least somewhat familiar with
music, not necessarily as composer of performer, but at least as a consumer. Also
some familiarity with evolutionary techniques is expected.
Martin Dostal
Dept. Computer Science, Palacky University Olomouc, 17. Listopadu 12,
77146 OLOMOUC, Czech Republic
e-mail: martin.dostal@upol.cz
I. Zelinka et al. (Eds.): Handbook of Optimization, ISRL 38, pp. 935964.
c Springer-Verlag Berlin Heidelberg 2013
springerlink.com


936

M. Dostal

Although it may seem unmusical or somewhat provocative, music composition


can also be understood as an optimization process. The human composer searches
in the space of all possible music compositions that he is able to compose, for one
such that satisfies his own artistic or other criteria, such as a style, length or instrumentation, for instance. Technically speaking, something like input constrains can
be more visible in performing applied arts; the artist works with some requirements
and constraints specified by the client and the artist is expected to create such an
(art)work that meets the requirements. In particular, evolutionary techniques are
used in music composition in such a way, that is, as a mechanism for creating or
variating musical pieces according to some specified criteria.
The chapter is organized as follows. First, music composition subtasks, such as
composing melodic material, harmonization, or generating rhythm accompaniment
will be introduced and a brief survey of previous work in these fields will be provided. Next section discusses commonly used techniques in machine-based music
composition. The following section discusses two distinct approaches used in creative systems, namely interactive and autonomous systems. Remaining sections will
introduce some recognized evolutionary systems for music composition in detail.
Used representation of musical knowledge, the design of evolutionary algorithm
and recombination operators will be discussed. In melodic development, GP-Music,
GenDash and GenJam will be described. The following section will describe PhonAmnuaisuks system for harmonization. In generating rhythm accompaniment two
systems, namely CONGA and GeneticDrummer, will be described.

1.1 Brief History


Human composers use very different approaches to music composition: from rather
formal, utilizing various musical knowledge and compositional theories, to intuitive,
rehearsal-based composition of music. Not surprisingly, the techniques resembling
algorithmic composition had been used yet prior to the rise of computers. For instance, Mozart proposed Musikalisches Wurfelspiel (Musical Dice Game), a system where a dice was used to random selection of short musical patterns that were
combined together [1]. Some other composers used choosing of random numbers
in assembling their compositions, such as Johann Philipp Kirnberger in The Ever
Ready Composer of Polonaises and Minuets (1757, 1783) or Joseph Haydn in the
Philharmonic Joke (1790). Reportedly, Mozart, Bach and Bartok used Fibonacci
numbers and golden section [36] in their compositions. However, it is somewhat
questionable whether the mathematical background was used on purpose or rather
intuitively by these composers.
A considerable growth of interest into computer-based composition (also including other areas of arts) has begun in late 80-ties of 20. century along with the
widespread popularity of machine learning and optimization techniques, especially
knowledge-based systems, neural networks and genetic algorithms. One of the first
successful attempts to utilize a computer in music composition was the Illiac Suite
by Hiller, Isaacson and Baker [1]. The computer was used to imitate the composition

Evolutionary Music Composition

937

process in a somewhat similar way to the later used evolutionary techniques. Iannis
Xenakis, a Romanian-born Greek composer, was one of the pioneers of algorithmic
composition. He used stochastic techniques in music composition and developed a
computer program that helped him in composition [53, 54].

1.2 Music Composition Subtasks


In this section we describe the main application areas of music composition systems
and provide a brief survey on previous work.
1.2.1

Melody (Motivic) Composition

Automatic composition of musical pieces is apparently one of the most challenging problems in machine art. In past twenty years several systems were developed
and some of them also successfully used in the composition of true musical pieces
(in contrast to experimental, or toy-like nature of some other systems) or live performances. Rodney Waschka II, an american composer known for usage of algorithmic composition methods, created a composition tool called GenDash [49, 50].
GenDash creates variations of musical motives using a genetic algorithm. Waschka
is one of composers that used his system successfully in publicly performed compositions including Saint Ambrose, Sapphos Breath (both chamber operas) [51]
or String Quartet: Ha! Fortune or Eclogues for Woodwind Quintet [50]. We descibe
GenDash in more detail in Section 3. Jacob [31, 32] also experimented with creating
variations of melodic motives using genetic algorithm. Jacobs system also considered an ear module for listening and evaluating composed melodies in contrast
to Waschkas system which omitted the fitness evaluation at all. GaMusic [39] was
a system for composing of two-octave melodies on the basis of interactive genetic
algorithm. Another attempt to evolve melodies using interactive genetic algorithm
has also been made by Ralley [40].
Johanson and Poli created the GP-Music system that evolves short melodic sequences according to both mentors preferences and autonomous measures by the
system itself [33]. GP-Music is a good example of a toy-like experimental system.
The system is based on genetic programming and we provide detailed description
of the system in Section 2.
Spector and Alpern [42, 43] proposed the GenBebop; a system for composing
short jazz improvisations, the so called trading fours. Trading fours refers to fourbar improvisations on a reply to recently played four bars by another player. However, generating bebop improvisations is only a particular application of Spector and
Alperns approach. Their aim was more general: they attempted at a system which
would enable a construction of artificial artists with some aesthetic tradition and particular musical preferences. Similar application area has also been investigated by
Biles who developed GenJam [8, 10, 11, 13]. It is one of the most referred evolutionary composition systems so far. GenJam is an interactive genetic algorithm-based
system for trading-fours improvisation. The system is, however, able to improvise
in real time, thus Biles used GenJam successfully at a lot of live performances with

938

M. Dostal

his Virtual Quintet, which is a combo of John A. Biles on trumpet or flugelhorn and
GenJam on tenor sax and other instruments. GenJam also participated on several
Biles music records with the Virtual Quintet.
Thywissen [44] introduced GeNotator, a hybrid-algorithmic composition tool for
computer assisted composition of music. Gibson and Byrne [21] designed a system for composing short musical pieces using diatonic, four-part Western harmony.
The system has been called NEUROGEN and utilized a genetic algorithm to compose music and neural networks to evaluate the quality of generated results. Unemi
[47, 48] created SBEAT, an interactive system for breeding short musical phrases
(e.g., rhythm patterns) in terms of musical patterns with various rhythm, pitch and
velocity.
A distinctive part of music composition has been investigated by Horner and
Goldberg who developed a system for thematic bridging [29]. Thematic bridging is
a process that lies in transforming one musical part into another musical part over
an interval of time.
1.2.2

Harmonization

Several researchers aimed at automated harmonization of musical phrases. Ebicoglu


[20] developed CHORAL, a system for the harmonization of chorales in the style
of J.S.Bach. Phon-Amnuaisuk et al. developed a system for the four part (soprano,
alto, tenor, bass) harmonization of user-specified melodies [5, 6]. The system was
based on genetic algorithm and supported also an autonomous evaluation of generated harmonies. We describe this approach in more detail in Section 5. Authors
were also interested in a comparison of methods that could be used to compose harmonic accompaniment. They have proposed a different version of the system; it was
based on a rule-based inference system instead of genetic algorithm [6]. According
to experimental results, the authors concluded that the rule-based implementation
produced better results than the genetic algorithm-based one.
Horner and Ayers [28] have developed a system that composes a harmonic progression using genetic algorithm using a rule-based approach. The rules are used
as constraints upon the search space of possible harmonies. The constraint rules are
of two types: first type defines how individual chords can be voiced and the second
type of rules defines how voices are allowed to change from a chord to next one
[15]. The process of harmonization is executed consecutively for each of the group
of constraint rules. McIntyre [38] also used genetic algorithm to harmonization. His
system generates chord sequences according to the rules of how chords should be
spelled and it is also used to autonomous evaluation of generated harmonies.
Hoover et al. [27] have proposed a system for harmonization of existing musical phrases called scaffolds. The system produces harmonic variations and rhythm
changes using a combination of evolutionary computation and neural networks. The
neural network is responsible for the scaffold transformation in terms of used pitches
and rhythm.
Issues related to machine harmonization of music had been critically discussed
by Wiggins [52]. Wiggins discusses various machine learning techniques used to

Evolutionary Music Composition

939

harmonization and points-out that the task of harmonization is not just a matter
of filling of the notes according to the rules of harmonization but also creating a
musical structure with a musical intention behind. The latter point is, however, not
taken into account in most systems that perform harmonization. In fact, a local performing of algorithmic composition systems (e.g., typically on the current measure
only) without a broader context, such as planning a structure of the composition,
is the property of most current systems. For instance, GeneticDrummer is such a
locally performing system. It generates a phrase with rhythm accompaniment by
individual measures. During the generating process the system does not see the preceding nor following measures so that the composition process is entirely local. The
consistence of resultant phrase is, however, ensured by the application of the same
constrains (specified by the fitness function) on each measure present in the phrase.
1.2.3

Rhythm

Horowitz [30] used interactive genetic algorithm for composing short rhythm patterns. The system used also some fitness criteria (e.g., syncopation, density, downbeat, beat repetition) that were derived from the mentors evaluation. Tokui and Iba
developed a system called CONGA [48], an evolutionary drum machine that evolves
multi-timbre rhythm patterns. CONGA is an interactive system extended with a neural network which performs as an evaluation assistant. The system combines genetic
algorithms and genetic programming: individual measures are generated using genetic algorithm whereas the complete phrases are bred using genetic programming,
see Section 6 for detailed description of the system. NEAT Drummer [26] evolves
rhythm patterns using a combination of neural networks and interactive evolutionary
computation.
GeneticDrummer [1719] is one of a few evolutionary systems that perform autonomous evaluation of generated results using various fitness operators. The system
evolves a rhythm accompaniment played on a common drumset. Another difference
to the most of other existing systems is that the rhythm accompaniment is evolved
to an existing musical phrase in addition to users specified preferences. That is, the
generated accompaniment should match the musical phrase to which is the rhythm
accompaniment being generated. We describe GeneticDrummer in detail in Section 7.

1.3 Methods and Techniques for Algorithmic Composition


In the previous section we surveyed briefly application areas of algorithmic composition. Another interesting point can be found in the employment of methods
and techniques behind algorithmic composition systems. Among widely used evolutionary techniques, such as genetic algorithms (GaMUsic, GenDash, GenJam,
GaNotator, Neurogen, GeneticDrummer . . . ) and genetic programming (GP-Music,
GenBeBop), various other techniques and methods has also been utilized in algorithmic composition. For instance, stochastic processes (including Markov chains)
[2, 16, 53, 54] has been widely used before the rise of evolutionary techniques.

940

M. Dostal

Cybernetic composer [4] is a representative example of systems based on Markov


chains. The system deduces the rhythm of a melody using Markov chains and composes a new melody at a later stage. Some attempts have also been made with
chaotic, non-linear systems [23, 24].
Knowledge based systems have been successfully used in harmonization [20, 46].
Harmonization as a musical task is supported with well grounded theory that can be
applied as a set of constrains and rules in a knowledge-based system. Some attempts
have also been made with grammar-based systems, see [34, 41] for more detail.
Neural networks have also attained certain popularity in algorithmic composition. Neural networks have been used in several hybrid systems (typically with genetic algorithms or genetic programming) to assist the composition process [14, 21].
In evaluation assistance tasks, neural networks learn responses from the mentor in
an interactive system and later helps the mentor with recommendations or a prefiltering the results [14, 33, 43, 45]. Another quite common usage of neural networks is learning from input data such as a melody, a harmony [25] or a rhythm
[26]. Baggi used also neural networks to composition of swing musical pieces [7].
Since this book chapter focuses on utilization of evolutionary computation techniques in various subtasks of music composition, the following text will discuss
some representative evolutionary systems and the evolutionary techniques behind
these systems. Genetic algorithms and genetic programming are obviously the two
most popular evolutionary techniques used in algorithmic composition. Although
the basic shape of these algorithms behind algorithmic composition systems is practically the same as in other more common or more formal applications of evolutionary computation, some differences can be identified. First, evolutionary music
composition systems typically use small populations, commonly between 10-50 individuals. Interactive systems, as discussed above, use small populations owing to
time consuming and demanding evaluation of individuals for the mentor. However,
systems with autonomous evaluation of individuals also use relatively small populations in comparison to other application areas of evolutionary computation. Initial populations in music composition systems, if not generated randomly, often
use typical examples (e.g., phrases, patterns or motives) of a particular genre, style
or rhythm, for instance. These populations contain typically tenths of individuals.
Broadly speaking, populations can be construed as an impression of ones musical invention (similarly to viewing an audio sample of a drum as impression of the
sound of such a musical instrument, for instance) and the evolutionary algorithm
itself as a creative machinery responsible for the composers hard work. The crucial
part of evolutionary systems is the fitness evaluation. In musical systems, the fitness
function is either based on some musically meaning criteria or an evaluation by the
mentor, as it is discussed in Section 1.4 in more detail. The mentors evaluation is
a quite specific property of many musical systems in a broad context of evolutionary systems and their applications. Also mutation operators are in musical systems
often designed to be musically meaning rather than purely random. The reason is
obvious, the mutation should produce at least acceptable individuals. However the
production of musically improper changes that breaks the rules may also be advantageous to some extent. The role of mutation in musical systems is often high in

Evolutionary Music Composition

941

comparison to occurrence of mutation in nature. Mutation is, beside crossover, the


crucial mechanism for creating variations of musical pieces.
Another important viewpoint for evolutionary techniques is the appropriateness
of individual techniques for particular musical subtasks. Seemingly, evolutionary
techniques can be great in musical tasks less constrained with complex rules. Typically, evolutionary techniques seem very appropriate for evolving of rhythm accompaniment. Why do we argue for that? The creation of appealing rhythm patterns or
grooves can be based on quite simple rules and the partial results can be creatively
combined into even better rhythms and patterns. Also establishing a rhythmical
coordination between a musical phrase and a rhythm accompaniment generated
evolutionary is not that a complex task. On the other side, usage of evolutionary techniques to harmonization seems less appropriate than using more formal
approaches, such as rule-based systems, for instance. Composing a harmony requires a wider and deeper musical knowledge in order to produce good sounding,
musically correct harmonies. Similar observation holds for generating melodic motives. In these musical tasks, a musically meaning structure for a musical piece or
a musical intention behind the composition must be devised evolutionary, which
seems to be a much more difficult task than creating appealing rhythm patterns. For
composing melodic motives or harmonization, knowledge-based approaches seem
more appropriate.

1.4 Interactive versus Autonomous Systems


1.4.1

Interactive Systems

Interactive evolutionary systems use evolutionary algorithms as a technique to


machine-based generating or combining of compositions. However, one important
part of the system, namely the evaluation of generated music, is not performed autonomously by the system itself but rather it is substituted by the decision of the
user. The user acts as a human mentor that assigns a rating that specifies the quality
of generated results. Typically, the quality is expressed by a number in a specified
range, or to simplify the process, it can be reduced to categorization of individuals into keepers or losers. Keepers survive to next generation, whereas losers are
removed. The justification for using a human mentor is obvious: the mentor can
evaluate the aesthetic quality of individuals that seems almost impossible to be evaluated algorithmically. The mentor is also subjective, which could be an advantage
or not, depending on the viewpoint.
One common difficulty in the practical use of interactive systems is the human fatigue. Basically, it has two dominant causes; first, the amount of evaluations is high
even in small populations. The mentor must evaluate each individual in each generation of the composition process which is pretty time consuming. Second, listening
carefully and critically to music fatigues quickly the mentor. Similarly, recording
engineers are faced daily with this phenomenon. It is not possible to hold long, continuous recording or mixing sessions for the engineer. Arguably, the task for the
mentor is about the same arduousness as for the engineer.

942

M. Dostal

Interactive systems thus typically use small populations in order to keep the
amount of evaluations admissible. Nonetheless, the task for the mentor is still
time consuming and fatiguing. Several interactive systems address this issue with
a machine-based mentor that helps the human in evaluation. These systems [14,
33, 43, 45] typically use an artificial neural network that learns from the mentors
responses and provide a preliminary evaluation or pre-filtering of results (e.g. autonomous identification of losers).
1.4.2

Autonomous Systems

These systems aims at the autonomous evaluation of generated music in terms of


quality. Though the autonomous evaluation of aesthetic quality or musical pleasingness seems not to be much viable for the computer, various quantitative or structurebased measures were devised to evaluate the music on such a basis. Autonomous
systems use typically heuristic rules, knowledge-based rules (typically coming from
the music theory) or some kind of learning from the mentor as it was mentioned
earlier. In evaluation of melodic material a variety of measures including horizontal
intervals, melodic contours, musical staff density, rhythm structure or syncopation
were devised [3, 36, 38, 42, 44]. In evaluation of generated harmonies also a rulebased approach was successfully used [6, 52]. Rhythm seems to be quite good evaluable using heuristic rules since the rhythm is to a large extent determined by structure of durations. No such a complex problems arise in rhythm evaluation in comparison to melodic or harmonic material. Also, the rhythm accompaniment seems
less subject to thematic development and thus can be reasonably evaluated at the
level of individual measures instead of evaluating long musical phrases. Horowitz
[30] evaluated syncopation, density, downbeat or beat repetition on the generated
short rhythm patterns. Dostal [17] proposed fitness operators that evaluate rhythm
consonance or dissonance with a particular musical pattern, dynamic consonance or
rhythm density of individual percussion instruments available in a drumset. These
operators are described in detail in Section 7.
Listening
1. Jacobss system for music composition. The webpage contains several samples
including a description.
http://www.eng.umd.edu/blj/algorithmic_composition/
2. GenBebop. The webpage contains a few jazz improvisations performed by the
Spectors and Alperns system.
http://hampshire.edu/lasCCS/genbebop.html
3. SBEAT. Over twenty examples of various styles and length.
http://www.intlab.soka.ac.jp/unemi/sbeat/sample.html

Evolutionary Music Composition

943

2 GP-Music
Johanson and Poli created the GP-Music system that evolves short melodic sequences according to both the mentors preferences and autonomous measures of
the system itself [33]. GP-Music is based on genetic programming. Basically, the
system is interactive, however the automated measures can be performed using an
extended version of the system that combines genetic programming with a neural
network. The network is trained using the mentors responses and performs an autonomous evaluation of generated music afterwards.
Individuals, that is musical sequences, are represented as program trees as widely
used in genetic programming. Terminals represent individuals notes (the following
subset of chromatic scale is available: C-4 C#4 D-4 D#4 E-4 F-4 F#4 G-4 G#4 A-5
A#5 B-5), chords (C-Chord, D-Chord, E-Chord, F-Chord, G-Chord, A-Chord, BChord) or rest. Notes have a constant duration. The function set contains operations
to constitute the sequence structure:

Play two (arity 2) concatenates two sequences together.


Add space (arity 1) inserts a rest after each event present in the input sequence.
Play twice (arity 1) repeats the sequence passed as parameter.
Shift up (arity 1) shifts notes in the sequence one note up.
Shift down (arity 1) shifts notes in the sequence one note down.
Mirror (arity 1) reverses the original sequence.
Play and mirror (arity 1) concatenates the original and reversed sequence
together.

Fig. 1 and Fig. 2 depicts an individual that represents the following sequence: [F-4
rest C-4 rest F#4 C#4 rest C D].
(PLAY-TWO
(PLAY-TWO
(ADD-SPACE (PLAY-TWO F-4 C-4))
F\#4)
(PLAY-TWO
(ADD-SPACE C\#4)
(PLAY-TWO C D)))
Fig. 1 Example of an individual in GP-Music

GP-Music uses standard genetic programming for evolving melodic sequences


[35]. The mentor evaluates individuals on a 1-100 scale in each generation. Thus
the same individual may obtain a different fitness during the repeated evaluation by
the mentor. Automated measures are performed using a modified back-propagation
neural network, see [33] for more detail about the network architecture.

944

M. Dostal

Fig. 2 Example of an individual in GP-Music

Listening
Authors provide several sound examples including a description of the parameter
setting.
http://graphics.stanford.edu/bjohanso/gp-music/
gp_music-old.html

3 GenDash
GenDash [49, 50] is a compositional tool developed and used by american composer
Rodney Waschka II. The system itself is intended for composing musical pieces in
a highly collaborative way with the human composer. Waschka successfully used
GenDash to compose complete musical pieces as well as to generate parts of pieces
that were further processed and arranged into musical pieces by the author.
GenDash is rather a music composition tool for the human composer than an
autonomous music composition system. The system is intended primarily to create variations of measures of music but without the evaluation of generated musical pieces by the human mentor or a fitness measure during the evolution process.
It means that GenDash lacks one fundamental part of an evolutionary system and
suggests that it is a compositional tool which the composer uses to generate some
musical pieces that he afterwards deliberately decides to use it in a piece or discard.
The technique behind GenDash is basically a genetic algorithm without fitness
evaluation. That is, individuals to be reproduced to the next generation are selected
at random. Individuals represent measures of music. The initial population of individuals is predefined by the user. For instance, Waschka used a population of
twenty-six measures of music drawn from typical Greek and Medieval songs for

Evolutionary Music Composition

945

composing Sapphos Breath, a one-act opera comprised of an overture and twelve


scenes [51].
New individuals are created using standard one-point crossover between two parents. GenDash also allows for mutation. Two types of mutation are possible. First
type is a mutation performed by the system, such as changing a pitch or a duration
of note. Second is the so called wildcard mutation that is based upon the altering of
the individual by the human composer.
Waschka reported successful usage of GenDash to compose ten musical pieces
including small- to medium-scale pieces up to 30-40 min duration. The author
tweaked the system individually for each one composition. Some details on GenDash usage on particular musical pieces can be found in [50, 51].
Listening
1. Waschka II, R. (1996). Empty Frames. Raleigh: Borik Press.
2. Waschka II, R. (2000). Saint Ambrose. Raleigh: Borik Press.
3. Waschka II, R. (2001). Sapphos Breath. Raleigh: Borik Press.

4 GenJam
GenJam (a short for Genetic Jammer) is a system for generating jazz melodic improvisations that has been developed by John A. Biles [8, 10, 11, 13]. The system is able
to improvise full-chorus solos and chase choruses in real time. Chasing choruses is a
standard practice in jazz improvisation where soloists improvise on four-bar phrases
on a tune in a way that a soloist chases the previously played phrase by another
soloist by developing a new four-bar phrase on the basis of the previously played
one. In GenJam, the chorus chasing is performed between a four-bar phrase played
live by the performer and GenJam which chases the performers improvisation. The
human performer plays a melody on an instrument that is converted in real-time to
corresponding MIDI events using the Roland GI-10 pitch-to-MIDI-converter. These
data are further processed by GenJam as it will be explained below.
GenJam is based on interactive genetic algorithm that breeds new melodies. Since
the system is interactive, the evaluation of generated phrases is performed by the human mentor. The mentor listens critically to generated results and provides on-going
feedback on the perceived quality by evaluating phrases as good, bad or neutral. As
it was mentioned, the system interacts with the performer and the mentor. Additionally, GenJam uses some other data required for the interactive genetic algorithm
operation:
Measure population that contains chromosomes. Each chromosome holds one
measure long melodic phrase and its fitness.
Phrase population. Chromosomes in Phrase population contains the phrase fitness and identifiers to corresponding measure chromosomes that constitute the
phrase.

946

M. Dostal

Rhythm sequence. It is a standard MIDI file containing usually three to five


tracks, typically piano, bass, drums and strings or guitar. The file is played back
during the live performance. It is used to evoke an illusion of a jazz quintet with
two soloists, that is the human performer and GenJam, and accompanying rhythm
trio.
Head sequence. Similar to the rhythm sequence, the head sequence is a standard
MIDI file that is played back during the live performance. The sequence contains
the original melody of a tune.
Chord progression. It contains the harmonic progression of the tune. The information about the harmonic structure is used by GenJam to ensure production of
harmonically correct notes.
Choruses. It provides information to GenJam how each of the choruses can be
handled. In example, a full-chorus solo, chase chorus or a rest.
GenJam operates in three modes, learning, breeding or demo. Learning mode is
used to evaluate phrases in population. Phrases are played-back in random order
and the mentor provides a feedback by responding g for good, b for bad, or a neutral
rating is considered if the mentor does not provide any feedback on the phrase.
Good evaluation from the mentor increases the fitness of the phase by one, while
bad evaluation decreases it by one. No response on the phrase does not affect its
fitness. Fitness values are bounded to interval < 30, 30 >. More details can be
found in [9].
Demo mode is used to select phrases for a live performance. The selection is
performed using a tournament selection. No feedback from the mentor is required
in this mode.
Breeding mode is intended for creating new phrases using recombination operations. In each application of the breeding mode one half of phrases in population is
replaced by newly bred phrases.
GenJam is designed to be able to operate on a live performance which is a quite
unique feature among music composition systems. Human player plays four bars
of a melody that GenJam listens to. The playing is transformed to MIDI events
and quantized into eight eighth-note-length intervals, depending on internal representation used by the genetic algorithm. In last thirty milliseconds of the humans
four bar phrase playing, the system breeds a new phrase. GenJam is aware about the
begin/end of the humans playing since the complete tune structure including the
chord progression and accompanying tracks is predefined. In other words, improvisations by the human and GenJam are performed on the beforehand determined
parts of the tune.

4.1 Population
GenJam uses two populations; a phrase population and a measure population.
Both populations are of fixed size: phrase population contains 48 individuals and
measure population holds 64 individuals. Individuals are encoded using bit-string
chromosomes.

Evolutionary Music Composition

947

A chromosome in phrase population encodes an identifier, fitness value and identifiers of individuals in the measure population that constitute the phrase. For example, consider a phrase chromosome depicted on Fig. 3. The chromosome has identifier 10, fitness -5 and the phrase is composed of four measure chromosomes with
the following identifiers: 20, 34, 11 and 23.

Fig. 3 Example of a phrase chromosome

A chromosome in measure population encodes its identifier (that is used to referencing measure chromosomes in phrase chromosomes), a fitness value and onemeasure-long melodic phrase in 4/4 time. A phrase is encoded in a series of eight
events, each representing one eighth-note-length event. These events are further
transformed to MIDI events and played by the synthesizer. An event may represent
either a note, a rest or a hold. Hold event has the effect of holding the previous event.
For example, if a note event is followed by one hold event, the note will be played
with quarter-note duration. Note events encode a relative note (pitch) of the event
(see below). Since the events are internally represented as four-bit strings, GenJam
is limited to 14 note scale at one time, 2 of 16 possible combinations are reserved to
the rest and hold events. The rest event is encoded in chromosome as 0, hold as 15
and note events as 1-14. See Fig. 4 which depicts four chromosomes referenced in
the phrase chromosome from Fig. 3. Fig. 4 contains chromosomes with ids 20, 34,
11 and 23 whose fitnesses are: -3, 12, -22 and 4.

Fig. 4 Examples of measure chromosomes

As it was stated above, note events encode relative notes while 14 different notes
are available. These relative notes are mapped using predefined scale maps and the
chord progression of the tune. Chord progression defines harmonic structure of the
tune (limited to two chords per measure at maximum). A note map is an array of
pitches representing a scale appropriate to the given chord. Since the scale may
not be composed roughly of 14 notes, the scale is extended to 14 notes using scale

948

M. Dostal

repetition. For example, a scale consisting of [C D E G A Bb] would be extended


to [C3 D E G A Bb C4 D E G A Bb C5 D]. Biles synthesized the scale maps from
some jazz educational literature. The resultant scale map is depicted in Table 1 [11].
Another, a more complex map can be found in [10]. Using chord progression and
scale maps, GenJam produces harmonically correct pitches only.

Table 1 Scale map


Chord
Cmaj7
C7
Cm7
Cm7b5
Cdim
C+
C7+
C7#11
C7#9
C7b9
Cm7b9
Cmaj7#11

Scale
Major (avoid 4th)

Mixolydian (4th)
Minor (avoid 6th)

Locrian (2nd)
W/H Diminished
Lydian Augmented
Whole Tone
Lydian Dominant
Altered Scale
H/W Diminished
Phrygian
Lydian

Notes
CDEGAB
C D E G A Bb
C D Eb F G Bb
C Eb F Gb Ab Bb
C D Eb F F# G# A B
C D E F# G# A B
C D E F# G# A#
C D E F# G A Bb
C Db Eb E F# G# Bb
C Db Eb E F# G A Bb
C Db Eb F G A Bb
C D E F# G A B

Obviously, this kind of representation is limited in several aspects. First, it can encode only eighth-note multiplies. Second, there is not possible to encode a dynamic
articulation of notes. Third, there are only 14 pitches available at the time. Finally,
the humans playing is quantized to eighth-note-length intervals which limits the
rhythmical expressivity of the system.
The populations are initialized at random at the outset of evolution. Each chromosome has assigned a fitness value equal to zero. In measure chromosomes, the
staff part is initialized with events. Each position is initialized either with a rest, a
1
and the probability
hold or a note event. The probability of a note event is set to 24
5
of a rest or and a hold event is set to 24 . Biles set the probabilities on the basis of
empirical observations.

4.2 Recombination Operators


In GenJam, selection and replacement of individuals is based on a modified tournament selection. A tournament is performed between four randomly selected individuals (i.e. without regard to their fitnesses). Two of four individuals with highest
fitnesses are selected as parents that undergo mating using crossover and mutation.
These newly produced offsprings are used as replacement of the latter two individuals (those two with lowest fitnesses) in the tournament.
Crossover operation is a slightly different version of standard single-point crossover. Crossover is performed at one randomly selected position in the event-part of

Evolutionary Music Composition

949

chromosomes. One of the offsprings then undergo mutation, while the other one is
kept unmodified.
Mutation is the most interesting operation of recombination operations in GenJam. It does not operate on a bit-level as many conventional, general-purpose mutation operations used in genetic algorithms, but rather at the level of individual
events. The point is to provide musically meaningful manipulation of measures encoded in chromosomes. GenJam performs mutation on both phrase and measure
chromosomes. On measure chromosomes, the following operations can be applied:
Identity. Returns identical, unmodified chromosome.
Reversion. Produces a chromosome with reverse order of events. For example,
a reversion of chromosome [20 -3 14 13 14 12 15 9 0 0] would result in [20 -3 0 0 9 15 12 14 13 14].
Right Rotation. The event-part of a chromosome is rotated by randomly chosen
number (between 1 and 7) of positions to the right. For example, a right rotation
of chromosome [20 -3 14 13 14 12 15 9 0 0] of 3 positions would
result in [20 -3 9 0 0 14 13 14 12 15].
Inversion. Each event is changed to 15-<event-value>. For example, an inversion of chromosome [20 -3 14 13 14 12 15 9 0 0] would result in
[20 -3 1 2 1 3 0 6 15 15].
Ascending Sort. Events in chromosome are sorted in ascending order. For example, ascending sort of chromosome [20 -3 14 13 14 12 15 9 0 0]
would result in [20 -3 0 0 9 12 13 14 14 15].
Descending Sort. Events in chromosome are sorted in descending order. For example, ascending sort of chromosome [20 -3 14 13 14 12 15 9 0 0]
would result in [20 -3 15 14 14 13 12 9 0 0].
Transposition. This operation is performed on a randomly selected number of
steps (between 1 and 4) on the direction of greater minimum distance between
the note-event and upper (i.e., 14) or lower (i.e., 1) bound. Hold and rest events
are unaffected. For example, a transposition of chromosome [20 -3 14 13
14 12 15 9 0 0] of 3 positions would result in [20 -3 11 10 11 9
12 6 0 0].
On phrase chromosomes the following operations can be applied:
Identity. Returns identical, unmodified chromosome.
Reversion. Produces a chromosome with reverse order of events. For example, a
reversion of chromosome [10 -5 20 34 11 23] would result in [10 -5
23 11 34 20].
Right Rotation. The event-part of a chromosome is rotated by randomly chosen
number (between 1 and 7) of positions to the right.
Genetic Repair. Replaces the reference to the worst chromosome in phrase with
randomly selected another one.
Super Phase. Generates completely new phrase. On each position a tournament
of three measure chromosomes is performed and a reference to the winning chromosome is stored at the corresponding position in phrase chromosome. Note that
this operation usually does not preserve any phrase from the parents.

950

M. Dostal

Lick Thinner. This operation replaces a reference to measure in the phrase chromosome that occurs in the phrase population most frequently. The reference is
replaced by another one selected at random. The role of the operator is to eliminate some occurrences of highly fit measures from the phrase population.
Orphan Phase. It operates opposite to the Super phase operation, that is the less
fit chromosomes are considered as winners from tournaments. This operation is
intended to increase the diversity of population.
Since GenJam is interactive system, the evaluation cannot be performed in every
generation of the breeding process. In Demo mode, only selection is performed. In
Breeding mode, all recombination operators are applied. Fitness values are assigned
interactively by the mentor in Learning mode. Biles also experimented with a different version of GenJam that eliminates the evaluation of generated results by the
mentor, see [12] for more detail. Biles and Anderson [14] have also made an attempt
to enhance the interactive evaluation by the mentor with a neural network that is able
to discover worst individuals in population. However, the experiments did not result
in much success.
Listening
The webpage contains several nice music examples including a description.
http://www.ist.rit.edu/jab/GenJam.html

5 Phon-Amnuaisuks Harmonization System


Phon-Amnuaisuk et al. developed a system for harmonizing user-specified melodies
[5, 6]. The system produces four-part (while one part is the input melody) homophonic tonal harmony using genetic algorithm. The genetic algorithm also
autonomously evaluates generated harmonies, so that in contrast to interactive systems, the evaluation does not rely completely on the user.
The system operates with four voices, soprano, alto, tenor and bass. Soprano
voice is assumed to be a melody voice. Chromosomes are represented in a matrixlike structure. Each chromosome contains five rows; the first four rows represents
voices (soprano, alto, tenor, bass) while the last row describes the duration of the
staff in individual voices. It follows that all voices have the same rhythm. Individual
chromosomes represent four-voice phrases and the recombination operations operate on the complete chromosome, not the individual voices.
Genetic algorithm uses standard single point crossover. Mutation of chromosomes is possible using the following musically meaning operations:
Peturb. Transposes alto, tenor and bass voices up or down by one tone or semitone. The selection of transposition direction is done at random.
Swap. The operation swaps two randomly picked voices (alto, tenor or bass).
It enables changing chords between open (open voicing is one that uses each
part on the closest harmonizing note) and closed (closed voicing refers to an
arrangement of the notes of chords within a narrow range) positions and changing

Evolutionary Music Composition

951

of inversions. Both open and closed harmony are common techniques for voicing
in harmonization.
Rechord. It generates a new chord from the melody stored in the soprano voice.
A chord is constituted by the note in soprano voice as a root note, and 3rd or 5th.
PhraseStart. Mutates the beginning of each phrase to start with tonic root position on a down beat.
PhraseEnd. Mutates the end of each phrase to end with a chord in root position.
Obviously, crossover and mutation can produce harmonically unpleasant results.
However, such individuals should be eliminated in the reproduction process.
The most interesting part of the system is the fitness evaluation of generated harmonic structures. Fitness evaluation is performed autonomously by the system. Fitness function utilizes common harmonization knowledge used in standard four-part
harmony writing. Harmonization knowledge in the system captures various types of
possible harmonic structures while some of them are preferred and some are not.
The evaluation of harmonic occurrences is performed on two levels, within voices
and between voices. For instance, within voices a stepwise progression is preferred
over large leaps, while dissonant chords and some kinds of leaps are penalized. Between voices, occurrences of parallel unison, parallel octaves or progression from
diminished 5th to perfect 5th, or crossing voices are penalized. More details on fitness evaluation can be found in [6].
Since the system evaluates only the harmonic movements between two adjacent
chords, it is not possible to compose large-scale and sophisticated harmonic progressions.
Authors also have developed a different version of the system which uses a rulebased inference engine instead of genetic algorithm. A comparison between the
systems has been made and the rule-based implementation has delivered substantially better results [6]. It is a quite presumable result, since the rule-based approach
seems to be more appropriate for harmonization tasks than genetic algorithm. The
process of writing harmonies is a well examined part of music composition theory,
but genetic algorithms provide rather an unstructured search in the problem domain.

6 CONGA
CONGA (COmposition iN Genetic Approach) [45] is an evolutionary drum machine that generates multi-timbre rhythm patterns. To generating rhythms, a combination of genetic algorithm and genetic programming is used. Genetic algorithm is
used to breed individuals, usually one measure long rhythm phrases that are further
arranged into 416 measures long rhythm patterns using genetic programming.
Basically, the system is interactive so that the evaluation of generated phrases
relies on the mentor. Note also that the system generates rhythm patterns without
any regard to other music, so that its purpose is much closer a drum machine rather
than a rhythm accompaniment composition system. However, CONGA also utilizes
a neural network that learns the mentors responses and provides an assistance in
evaluation of individuals.

952

M. Dostal

6.1 Generating Phrases


Phrases are generated using genetic algorithm. Individuals in population represent
short phrases, usually one measure or half-measure long ones. Individuals are represented in two-dimensional chromosomes with a matrix-like structure. Rows represent individual timbres (drum instruments) and columns represent individual events
in the phrase. In fact, the representation is close to the way how the classic patternoriented sequencers (e.g., ROLAND TB-303) were programmed by the user. Each
column corresponds to a predefined note duration according to the chosen resolution of the system, e.g., one sixteenth or one eighth note. So that, according to the
resolution and meter, the chromosome has the corresponding length, e.g, for 1/16
note resolution and 3/4 meter, the chromosome length will be equal to 12. Events
are described by integer values, 0 is used for rest, and 1-127 for note-events. The
value describes the strength of the stroke that corresponds to the velocity parameter
used in MIDI devices. The number of timbers is also user-definable so that the chromosome will contain as many rows as the number of individual timbres. We depict
an example of chromosome and corresponding notation on Fig. 5. The chromosome
contains three timbres, hi-hat (HH), snare (SD) and bass drum (BD). The resolution
was set to 1/16 note. This simple representation, however, does not enable to capture some other nuances of drum playing, such as different stroke types (e.g, double
stroke, flam of drag stroke) or possible instrumentations of particular drum timbers
(e.g., head or rim stroke on drums, or bell or bow stroke on cymbals).

Fig. 5 Example of a phrase chromosome in CONGA

In CONGA, two crossover operations are available. First, standard one point
crossover which exchanges selected parts between parental chromosomes and second, a crossover operation that exchanges selected timbers between the parents.
Likewise many other genetic algorithm-based generative systems, GONGA uses
several musically meaning mutation operators:
Random. Mutates selected chromosome positions with randomly selected values
(0-127).

Evolutionary Music Composition

953

Rotation. Rotates a timbre in the chromosome.


Reverse. Reverses a timbre in the chromosome.
Timbre exchange. Exchange selected timbre parts with the selected chromosome.

6.2 Arranging Phrases to Patterns


Individual phrases generated by the above outlined genetic algorithm are arranged
into 416 measures long patterns using genetic programming [35]. Thus, the patterns are represented as programs with a tree structure. Terminal nodes represent
references to individual phrases or the Random function, and the non-terminal nodes
represent functions from the function set that constitute phrases. The following functions are available:
Sequence. Operates on two nodes. Plays NODE1 and NODE2 consecutively.
Repetition. Operates on two nodes. Repeats NODE1 until the length of NODE1
is equal to length of NODE2.
Concatenation. Operates on two nodes. Plays the first half of NODE1 and the
second half of NODE2 consecutively.
Reversion. Operates on one node which is played in reverse order.
Random. Plays a randomly selected phrase individual available in the pattern
individual.
Fig. 6 depicts an example of phrase in tree representation. Two phrases (i.e., I-4 and
I-5) appear in the pattern chromosome that corresponds to the sequence [first
half of I-5] [second-half of I-5 or I-4] [I-4] [I-5].

Fig. 6 Example of a pattern chromosome in CONGA

6.3 Operating with CONGA


The user is allowed to parametrize CONGA in various aspects, such as population
sizes or length of generated patterns or used timbers. The system outputs to MIDI
and can be synchronized with another MIDI devices using MTC (MIDI time clock).

954

M. Dostal

Using that, the mentor is able to evaluate the evolved patterns with consideration of
some other music played by another MIDI devices.
As it was mentioned above, CONGA utilizes also a neural network that provides an evaluation assistance to the mentor. A three-layer back-propagation network learns the responses from the mentor. The assistance is provided in terms of
preselection of highly fit individuals to the mentor in order to reduce the psychological burden caused by evaluation of each evolved individual.

7 GeneticDrummer
GeneticDrummer is an evolutionary composer of rhythm accompaniment. The system has been developed between 2000 and 2002 by Dostal [17], the author of
this chapter. The system composes a matching rhythm accompaniment to the given
musical piece. Internally, it uses genetic algorithm that performs, contrary to most
evolutionary rhythm generators, autonomous quality evaluation of generated accompaniment using a fitness function. The user, however, specifies the fitness criteria in
order to define the preferred aspects of resulting rhythm accompaniment. GeneticDrummer listens also to one selected instrument part of the musical piece (e.g., a
bass-guitar or rhythm piano part) to which a rhythm accompaniment will be composed in order to produce an accompaniment that matches with the music. In GeneticDrummer, the aspect of musically meaning design of the system and the ability to
perform autonomously is strongly emphasized. The system uses musically meaning
representation that captures typical drum playing techniques and instrumentation
possibilities of individual drums available in the system. Also, the design of mutation and fitness operations attempts to be musically meaning. These aspects will be
introduced in more detail later in this section.

7.1 Representation of Rhythm


In GeneticDrummer, the representation enables to express fine nuances of drum
playing technical possibilities utilized by human drum players and also the individual instrumentation possibilities of percussion instruments. The representation
captures a conventional drumset consisting of a snare drum, a bass drum, four tomtoms, a hi-hat, two crash cymbals, a splash, and a ride cymbal. Each drum instrument
enables some instrumentation techniques. For instance, on snare drum a head drum
stroke, a rim stroke or a rimshot (that is a hit to the rim and head simultaneously) is
possible, whereas on bass drum only a kick pedal stroke is available. Another good
example of instrumentation possibilities can be provided with cymbals. Ride cymbal is usually played on the bow, edge or bell while the hi-hat is played on bow or
edge. On hi-hat, the level of cymbals openness is controlled using a foot pedal. All
of these individual instrumentation differences are captured in GeneticDrummer.
However, drum technique nuances utilized by human players are also particularly
important for musically meaning and flexible representation. When human drummer plays drums with drumsticks, it is possible (and also commonly used) to play

Evolutionary Music Composition

955

more than one note using one drum stroke. These kinds of drum strokes are great to
coloring the rhythm accompaniment with fine nuances. Fig. 7 depicts types of drum
strokes available in GeneticDrummer. That is, a drum stroke is the basic musical element in GeneticDrummer, not a note as commonly used in other rhythm generation
systems. Note also, that this approach is commonly used in drum notation, where
multiple drum strokes are identified by a particular symbol instead of writing-down
individual notes corresponding to the drum stroke type. In a pattern, drum stroke
types can be easily interchanged (e.g., single stroke to double stroke or vice versa)
and thus used to produce naturally sounding rhythm variations easily.

Fig. 7 Drum stroke types available in GeneticDrummer

Drum strokes of individual drums or cymbals are encoded with integer values
called rhythm elements which are stored at individual positions in chromosomes. A
rhythm element encodes a drum stroke type and a drum stroke volume. Drum stroke
volume is specified on a six-point scale from piano to forte fortissimo. Each drum
instrument has assigned an interpretation table that is used to encode and decode
rhythm elements for individual drum instruments. For instance, Table 2 depicts the
interpretation table for the snare drum. There is also one special rhythm element:
a rest, that is encoded with the zero value. Other interpretation tables and further
details on rhythm elements can be found in [19].

956

M. Dostal

Table 2 Snare drum interpretation table


playing technique
single drumhead stroke
double drumhead stroke
triple drumhead stroke
drumhead flam stroke
drumhead drag stroke
drumhead ruff stroke
single side-stick stroke

p
11
21
31
41
51
61
71

mp
12
22
32
42
52
62
72

mf
13
23
33
43
53
63
73

f
14
24
34
44
54
64
74

ff
15
25
35
45
55
65
75

fff
16
26
36
46
56
66
76

Individuals in a population are represented using multichromosomes. Multichromosomes hold one measure long rhythm patterns. A multichromosome is a list
structure composed of chromosomes. Each chromosome corresponds to a particular
percussion instrument and is composed of rhythm elements, see Fig. 8.
((chromosome
(chromosome
(chromosome
(chromosome
(chromosome
(chromosome
(chromosome
(chromosome
(chromosome
(chromosome
(chromosome

representing
representing
representing
representing
representing
representing
representing
representing
representing
representing
representing

splash cymbal)
crash cymbal 2)
crash cymbal 1)
ride cymbal)
hi-hat)
snare drum)
bass drum)
small tom-tom)
medium tom-tom)
large tom-tom)
floor-tom))

Fig. 8 Multichromsome structure

Chromosomes are encoded in a pattern-like style, that is each position corresponds to a particular duration depending on the internal resolution of the system
and the metre of multichromosome. The most commonly used internal resolution in
multichromosomes is one sixteenth-note. Using that resolution a chromosome with
4/4 metre will contain 16 positions. Fig. 9 depicts a sample multichromosome in 4/4
metre and the corresponding notation. The (empty) element represent a chromosome composed of rests, that is (00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00).
The pattern-oriented representation of rhythm is easy to use in computers, but
it does not enable to encode triplets directly. To encode triplets we use a special
value 300 that is added to the rhythm element value if a note should be shifted to a
triplet division. For instance, Fig. 10 depicts such an example of triplet coding. This
method of triplet coding was inspired with triplet coding used in pattern sequencers.

Evolutionary Music Composition

957

((empty)
(empty)
(empty)
(empty)
(14 00 14 00 14 00 14 00 44 00 74 00 24 00 15 00)
(00 00 00 00 14 00 00 00 00 00 00 00 14 00 00 00)
(14 00 00 00 00 00 14 00 14 00 00 00 00 00 00 00)
(empty)
(empty)
(empty)
(empty))

Fig. 9 Multichromosome and notation example


score:

chromosome:
(14 314 314 0 14 314 314 0 14 314 314 0 14 314 314 0)
Fig. 10 Triplet coding example

As it was stated above, individuals in a population are encoded with multichromosomes. GeneticDrummer uses two populations, one for generating the accompaniment (the so called groove populaion) and one for generating rhythm breaks (the
so called break population). Rhythm breaks may appear at the last measure of a
generated phrase. Needless to say that as a groove population can also be used a set
of individuals representing drum breaks, if the user has an intention to generate a
longer drum solo.
From the musical standpoint, the population contains one measure long drum patterns of particular rhythm and drum-playing style. The populations can be composed
of typical grooves of a particular human player, for instance. In this case, the GeneticDrummer is able to, to some extent, imitate the playing style of the human player.
Another good approach to build-up populations, is to take a drum-practice book and
rewrite typical patterns of particular rhythm into multichromosomes. It was actually
the most frequently used approach to build-up the populations for experimenting
with GeneticDrummer. The last, a quite appealing, possibility is to record drum
patterns played live by the human drummer on drum pads using a MIDI drum
trigger module and afterwards transform these MIDI data into the format of

958

M. Dostal

multichromosomes. Unfortunately, the transformation must be done manually at


the present since the conversion from MIDI to multichromosomes is not yet implemented in GeneticDrummer.

7.2 Genetic Algorithm


Basically, GeneticDrummer utilizes the well known Simple Genetic Algorithm
(SGA) [22] that is adjusted to the above introduced representation, musically meaning fitness and mutation. Standard two parent, one-point crossover is used to create
new individuals. Crossover performs on multichromosomes, that is each chromosome within the multichromosome is crossed at the same position. Two offspring
multichromosomes are produced as a result of crossover. Reproduction is performed
using the standard roulette-wheel proportional selection.
Mutation and fitness is the crucial part of GeneticDrummers genetic algorithm
that is most responsible for producing acceptable results. Both mutation and fitness
are functions (written in CommonLisp as the GeneticDrummer itself) that perform
mutation of multichromosomes or fitness evaluation of multichromosomes, respectively. In mutation, several the so called mutation operators can be used. Mutation
operators are built-in functions that perform mutation at the level of chromosomes.
Similar to mutation operators, a fitness function can utilize several built-in fitness
operators. Fitness operators also operate on chromosomes. Thus, a fitness function
should return a number between -100 and 100. The higher value is returned the
higher quality the multichromosome is. Fitness values above 100 are cut to 100 and
values below -100, non-numeric values or evaluations that resulted into an error are
set to -100. Since the majority of the fitness and mutation operators performs on
chromosomes with regard to the selected track of accompanying music, the operators usually take a chromosome, a measure of accompanying music and some other
values specific to the particular operator as parameters. Some fitness operators, however, does evaluate the chromosome according to the users specified ideal result
instead of a measure of accompanying music. The fitness operators are following
(the ai parameter represents a measure of accompanying music, chromosome
represents a chromosome, that is a measure of a particular percussion instrument,
ideal-value parameter represents the desired level of particular musical effect
evaluated by the fitness operator, such as the rhythm density for instance. Ideal value
is a number between 0 and 1, where 0 represents no occurrence of a particular effect
and 1 represent maximum occurrence of such effect):
(rhythm-conformity ai chromosome) evaluates a rhythm consonance
between the chromosome and the accompanying instrument. This operator is
used typically to evaluate a rhythm consonance between the bass drum and bass
guitar, for instance. It is also great in generating solos.
(rhythm-unconformity ai chromosome) is an inverse operator to
rhythm-conformity. Rhythmically dissonant chromosomes are preferred.
(dynamic-conformity ai chromosome) evaluates the dynamic conformity between the chromosome and accompanying music. This operator is

Evolutionary Music Composition

959

used to evaluate dynamic phrasing between drums and accompanying music or


evaluating crescendos.
(instrument-quantity ideal-value chromosome) evaluates the
density of drum strokes according the user specified ideal-value. The operator
also takes care about multiple drum strokes, thus double strokes are considered
more rhythmically dense than single strokes, for instance. This operator is useful
to let the user specify how dense drum breaks or bass-drum (e.g., double bass
drum cadences typical to heavy metal drums) patterns are preferred.
(instrument-quantity-on-strong-beats ideal-value
strong-beats chromosome) operates similar to the previous operator, but
the evaluation is performed on the strong beats only. This operator is used for
evaluating a syncopation.
Return values of the fitness operators are between 0 and 1. Zero means least success and 1 means maximum success. Mutation operators counterpart fitness operators. The following mutation operators perform on individual positions (rhythmelements) in chromosomes with a given probability. On each position a probabilistic
test is performed in order to decide whether to apply the operator on the position or
let the position unchanged. The following mutation operators are available:
(mut-rhythm-element-change p chromosome) alters a drum stroke
type with given probability p. For instance, it can alter single stroke with the flam
stroke.
(mut-accentuate p ai chromosome) accentuates rhythm elements according to the rhythm of accompanying music with given probability p. This
operator is useful in generating breaks to imitate the phrasing of accompanying
music.
(mut-bass-teamwork p ai chromosome) improves the rhythm consonance between a chromosome (that is a particular percussion instrument) and
accompanying music. The operator is applied with a given probability p.
(mut-syncopize p ai chromosome strong-beats) performs simple syncopation on the chromosome by means of moving a rhythm element from
a strong beat one position forward or back. This operator is particularly used in
swing tunes to imitate the effect of syncopation.
Fitness as well as mutation operators are described in much more detail [17] including the corresponding formulas. Fig. 11 depicts a typical example of a mutation function in GeneticDrummer. This mutation function with probability of 6%
changes the rhythm elements of crash cymbal 1 (notes-cc-1) and bass drum
(notes-bass) to the rhythm of accompanying instrument. This is typical for generating the end of multi-measure breaks, when the break ends with some ostinato
strokes on cymbals and bass drum.
Fig. 12 depicts an example of a fitness function. This fitness function prefers a
light accompaniment on snare notes-snare) and tom-toms (notes-tt-10,
notes-tt-12, notes-tt-13) that rhythmically follows the accompanying
instrument.

960

M. Dostal

(lambda (music)
(mutation-bass-teamwork notes-cc-1 0.06 music)
(mutation-bass-teamwork notes-bass 0.06 music))
Fig. 11 Mutation function example
(lambda
(+ (*
(*
(*
(*
(*
(*
(*
(*

(music)
10 (instrument-quantity notes-snare 0.2))
10 (instrument-quantity notes-tt-10 0.2))
10 (instrument-quantity notes-tt-12 0.2))
10 (instrument-quantity notes-tt-13 0.2))
20 (rhythm-conformity notes-snare music))
20 (rhythm-conformity notes-tt-10 music))
20 (rhythm-conformity notes-tt-12 music))
20 (rhythm-conformity notes-tt-13 music))))

Fig. 12 Fitness function example

One run of the genetic algorithm produces one measure long rhythm accompaniment to one measure of accompanying music. The inputs to genetic algorithm are
following: a population, a fitness function, a mutation function, a measure of accompanying music and the parameters applied to genetic algorithm such as the number
of generations, or starting position for generating a break. After passing the given
number of generating the individual with highest fitness is returned as result.
The rhythm accompaniment to a complete phrase is generated by the repeated
application of the genetic algorithm with the same parameters except the measure
with accompanying instrument which is obviously set to the next measure before
generating next measure of rhythm accompaniment. After generating all measures
of the rhythm accompaniment, the genetic algorithm is executed once again in order to generate a break. A break population is used instead the groove population
and also the fitness and mutation is defined specifically for generating a break. Afterwards the last measure of generated groove and generated break are combined
together according to the system settings: a user can set at which bar should the
break start.

7.3 Interaction with GeneticDrummer


To generate a rhythm accompaniment to a complete tune, the user is obliged to select
an accompanying instrument to which the drum accompaniment is to be generated.
Then the user cuts the track with the accompanying instrument into phrases of arbitrary length. Typically, the phrases correspond to verses and choruses. Phrases can
have different length. For each phrase, the user defines parameters to the genetic
algorithm, as it was described earlier. The real interaction with GeneticDrummer

Evolutionary Music Composition

961

is relatively easy for the user. GeneticDrummer communicates with the Cakewalk
ProAudio, a well known DAW application.
The author is developing a new, more advanced version of GeneticDrummer that
is about to be introduced in 2012.
Listening
GeneticDrummer has been used in various genres, such as jazz, rock or latin. Note,
that the below presented results represent a rough result from the GeneticDrummer
and thus they were not edited afterwards by the user in any way, except for sound
processing.
1. Chicken, funk classic by Pee Wee Ellis.
http://dostal.inf.upol.cz/data/mp3/chicken-2011.mp3
The bass guitar part was used as music accompanying track to which the drum
accompaniment was evolved.
2. A Night in Tunisia, a jazz standard written by Dizzy Gillespie.
http://dostal.inf.upol.cz/data/mp3/nit.mp3
3. Blue Bossa, an instrumental jazz tune written by Kenny Dorham.
http://dostal.inf.upol.cz/data/mp3/bluebossa.mp3
4. Summertime, from Porgy and Bess opera written by George Gershwin.
http://dostal.inf.upol.cz/data/mp3/summertime.mp3
5. Sockshop, a typical rock and roll tune.
http://dostal.inf.upol.cz/data/mp3/sockshop.mp3
Used groove population:
http://dostal.inf.upol.cz/data/mp3/
sockshop-groove-pop.mp3
Poulation used for breaks:
http://dostal.inf.upol.cz/data/mp3/
sockshop-break-pop.mp3.

8 Conclusion
Evolutionary music composition has become widely used and popular technique
in algorithmic composition. Seemingly, the interest of researchers is growing; the
number of various conferences, workshops and books on algorithmic composition
is growing. Also, there are artists interested in utilization of algorithmic composition
techniques in their artworks. Some music composition systems, such as GenDash or
GenJam have appeared in various compositions or live performances. GenJam has
been used on around 300 various jazz tunes. The system is also used by the author
in his VirtualQuintet on various recordings, tutorials and live gigs.
However, there is a field of problems that require further systematic investigation
including finding promising representation, measurement of aesthetic criteria or developing a theoretical background on generative art. McCormack in his work [37]
formulates and discusses five open problems in evolutionary art in detail.

962

M. Dostal

References
1.
2.
3.
4.
5.

6.

7.
8.
9.
10.

11.
12.
13.
14.

15.
16.
17.

18.
19.

20.
21.

22.

Alpern, A.: Techniques for algorithmic composition of music (1995)


Ames, C.: The markov process as a compositional model: A survey and tutorial
Ames, C.: Quantifying musical merit. Interface 21, 5393 (1992)
Ames, C., Domino, M.: Cybernetic composer: an overview, pp. 186205. MIT Press,
Cambridge (1992)
Amnuaisuk, S.P., Tuson, A., Wiggins, G.: Evolving musical harmonisation. In: Proceedings of the 4th International Conference on Artificial Neural Networks and Genetic Algorithms, Springer (1999)
Amnuaisuk, S.P., Wiggins, G.A.: The four-part harmonisation problem: A comparison
between genetic algorithms and a rule-based system. In: Proceedings of the AISB 1999
Symposium on Musical Creativity, pp. 2834. AISB (1999)
Baggi, D.L.: Neurswing: an intelligent workbench for the investigation of swing in jazz.
Computer 24, 6064 (1991)
Biles, J.A.: GenJam: A genetic algorithm for generating jazz solos (1994)
Biles, J.A.: Genjam populi: Training an iga via audience-mediated performance (1995)
Biles, J.A.: Interactive genjam: Integrating real-time performance with a genetic algorithm. In: Proceedings of the 1998 International Computer Music Conference, ICMC
1998 (1998)
Biles, J.A.: Life with genjam: Interacting with a musical iga. In: Proceedings of the 1999
IEEE International Conference on Systems, Man, and Cybernetics (1999)
Biles, J.A.: Autonomous GenJam: Eliminating the fitness bottleneck by eliminating fitness (2001)
Biles, J.A.: GenJam: evolution of a jazz improviser, pp. 165187. Morgan Kaufmann
Publishers Inc., San Francisco (2002)
Biles, J.A., Anderson, P.G., Loggi, L.W.: Neural network fitness functions for a musical ga. In: Proceedings of the International ICSC Symposium on Intelligent Industrial
Automation (IIA 1996) and Soft Computing (SOCO 1996), pp. 3944. ICSC Academic
Press (1996)
Burton, A.R., Vladimirova, T.: Generation of musical sequences with genetic techniques.
Computer Music Journal 23(4), 5973 (1999)
Camboropoulos, E.: Markov chains as an aid to computer assisted composition. Musical
Praxis 1(1), 4152 (1994)
Dostal, M.: Genetic algorithms as a model of musical creativity - on generating of a
human-like rhythmic accompaniment. Computers and Artificial Intelligence 24(3), 321
340 (2005)
Dostal, M.: The genetic drummer plays funk! In: ArtEscapes: Variations of Life in the
Media Arts, Catalogue of the EvoMUSART 2007 Exhibition (2007)
Dostal, M.: Towards representation of rhythm in genetic algorithm. In: New Trends in
Artificial Intelligence, Proceddings of EPIA 2007, 13th Portuguese Conference on Artificial Intelligence. Associacao Portuguesa para a Inteligencia Artificial (APPIA) (2007)
Ebcioglu, K.: An expert system for harmonizing four-part chorales, pp. 385401. MIT
Press, Cambridge (1992)
Gibson, P.M., Byrne, J.A.: NEUROGEN: musical composition using genetic algorithms
and cooperating neural networks. In: Second International Conference on Artificial Neural Networks, pp. 309313. IEEE, New York (1991)
Goldberg, D.E.: Genetic Algorithms in Search, Optimization and Machine Learning, 1st
edn. Addison-Wesley Longman Publishing Co., Inc., Boston (1989)

Evolutionary Music Composition

963

23. Harley, J.: Algorithms adapted from chaos theory: Compositional considerations.
In: Proc. of the 1994 International Computer Music Conference, Aarhus, Denmark,
pp. 209212 (1994)
24. Herman, M.: Deterministic chaos, iterative models, dynamical systems and their application in algorithmic composition. In: Proceedings of the International Computer Music
Conference (1993)
25. Hild, H., Feulner, J., Menzel, W.: Harmonet: A neural net for harmonizing chorales in the
style of j. s. bach. In: Moody, J.E., Hanson, S.J., Lippmann, R. (eds.) NIPS, pp. 267274.
Morgan Kaufmann (1991)
26. Hoover, A.K., Rosario, M.P., Stanley, K.O.: Scaffolding for interactively evolving novel
drum tracks for existing songs. In: Proceedings of the 2008 Conference on Applications
of Evolutionary Computing, Evo 2008, pp. 412422. Springer, Heidelberg (2008)
27. Hoover, A.K., Szerlip, P.A., Stanley, K.O.: Interactively evolving harmonies through
functional scaffolding. In: Proceedings of the 13th Annual Conference on Genetic and
Evolutionary Computation, GECCO 2011, pp. 387394. ACM, New York (2011)
28. Horner, A., Ayers, L.: Harmonisation of musical progressions with genetic algorithms.
In: Proceedings of the 1995 International Computer Music Conference, pp. 483484.
ICMA, San Francisco (1995)
29. Horner, A., Goldberg, D.E.: Genetic algorithms and Computer-Assisted music composition. In: International Conference on Genetic Algorithms, pp. 437441 (1991)
30. Horowitz, D.: Generating rhythms with genetic algorithms. In: Proceedings of the 1994
International Computer Music Conference, pp. 142143. ICMA, San Francisco (1994)
31. Jacob, B.L.: Composing with genetic algorithms. In: International Computer Music Conference (January 1995)
32. Jacob, B.L.: Algorithmic composition as a model of creativity. Org. Sound 1, 157165
(1996)
33. Johanson, B., Poli, R.: GP-music: an interactive genetic programming system for music generation with automated fitness raters. In: Proceedings of the Third International
Conference on Genetic Programming (1998)
34. Keller, R.M., Morrison, D.R.: A grammatical approach to automatic improvisation.
Technical report
35. Koza, J.R.: Genetic programming - on the programming of computers by means of natural selection. In: Complex Adaptive Systems. MIT Press (1993)
36. Livio, M.: The Golden Ratio: The Story of Phi, the Worlds Most Astonishing Number.
Broadway Books (2002)
37. McCormack, J.: Open Problems in Evolutionary Music and Art. In: Rothlauf, F., Branke,
J., Cagnoni, S., Corne, D.W., Drechsler, R., Jin, Y., Machado, P., Marchiori, E., Romero,
J., Smith, G.D., Squillero, G. (eds.) EvoWorkshops 2005. LNCS, vol. 3449, pp. 428436.
Springer, Heidelberg (2005)
38. McIntyre, R.A.: Bach in a box: The evolution of four part baroque harmony using the
genetic algorithm. In: International Conference on Evolutionary Computation, pp. 852
857 (1994)
39. Moore, J.H.: Gamusic: Genetic algorithm to evolve musical melodies (1994)
40. Ralley, D.: Genetic algorithms as a tool for melodic development. In: Proceedings of the
International Computer Music Conference, Banff, Canada, pp. 501502 (1995)
41. Roads, C.: Grammars as representations for music. In: Roads, C., Strawn, J. (eds.) Foundations of Computer Music, pp. 403442. MIT Press, Cambridge (1985)

964

M. Dostal

42. Spector, L., Alpern, A.: Criticism, culture, and the automatic generation of artworks. In:
AAAI 1994: Proceedings of the Twelfth National Conference on Artificial Intelligence,
vol. 1, pp. 38. American Association for Artificial Intelligence, Menlo Park (1994)
43. Spector, L., Alpern, A.: Induction and recapitulation of deep musical structure. In: Proceedings of the IFCAI 1995 Workshop on Artificial Intelligence and Music, pp. 4148
(1995)
44. Thywissen, K.: Genotator: an environment for investigating the application of genetic
algorithms in computer assisted composition. In: Proceedings of the 1996 International
Computer Music Conference, pp. 274277. ICMA, San Francisco (1996)
45. Tokui, N., Iba, H.: Music composition with interactive evolutionary computation. In:
Proceedings of the Generative Art International Conference, Milan, Italy (2000)
46. Tsang, C.P., Aitken, M.: Harmonizing music as a discipline of constraint logic programming. In: Proceedings of then International Computer Music Conference (1991)
47. Unemi, T.: A design of genetic encoding for breeding short musical pieces. In: Workshop
on Artificial Life Models for Musical Applications II: Search for Musical Creativity,
pp. 2529 (2002)
48. Unemi, T.: Sbeat3: a tool for multi-part music composition by simulated breeding. In:
Proceedings of the Eighth International Conference on Artificial Life, pp. 410413. MIT
Press, Cambridge (2003)
49. Waschka, R.: Avoiding the fitness bottleneck using genetic algorithms to compose
orchestral music. In: Proceedings of the International Computer Music Conference,
pp. 201203 (1999)
50. Waschka, R.: Composing with Genetic Algorithms: GenDash, ch. 6, pp. 117136.
Springer (2007)
51. Waschka, R.: Theories of evolutionary algorithms and a new simplicity opera: Making
sapphos breath. In: Artificial Life Models for Musical Applications, pp. 7986 (2011)
52. Wiggins, G.A.: Automated generation of musical harmony: whats missing? In: Proceedings of the International Joint Conference in Artifical Intelligence 1999, IJCAI 1999
(1999)
53. Xenakis, I.: Formalized music thought and mathematics in composition. Indiana university press (1971)
54. Xenakis, I.: Formalized music: thought and mathematics in composition. Harmonologia
series. Pendragon Press (1992)

Potrebbero piacerti anche