Sie sind auf Seite 1von 75

UNIVERSITY OF CALIFORNIA, SAN DIEGO

Evolving Waveforms with Genetic Algorithms

A thesis submitted in partial satisfaction of the requirements for the degree Masters of Arts in Music

by

Cristyn Magnus

Committee in charge: Professor Miller Puckette, chair Professor F. Richard Moore Professor Rand Steiger

2003

Copyright Cristyn Magnus, 2003 All rights reserved.

The thesis of Cristyn Magnus is approved:

Chair

University of California, San Diego

2003

iii

To P.D., for being an amazingly supportive, innitely (more or less) patient, loving husband.

iv

The beans appear dark and oily before grinding, but make coee which is light to medium-bodied in the cup, accented by a heavily roasted aroma and satisfying dark, rich avor. [Joe]

TABLE OF CONTENTS Signature Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii vi

List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix xi

Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii I Overview of Genetic Algorithms . . . . . . . . . . . . . 1.1 Typical Applications . . . . . . . . . . . . . . . . . 1.2 A Simple Genetic Algorithm . . . . . . . . . . . . . 1.2.1 Representation . . . . . . . . . . . . . . . . . . 1.2.2 Fitness . . . . . . . . . . . . . . . . . . . . . . 1.2.3 Reproduction . . . . . . . . . . . . . . . . . . 1.3 Modication to Algorithm and User Bias . . . . . . 1.3.1 Example of Bias Through the Fitness Function 1.3.2 Example of Bias Through Representation . . . 1.3.3 Example of Bias Through Mutation . . . . . . Literature Review . . . . . . . . . . . . . . 2.0.4 Introduction . . . . . . . . . . . . 2.0.5 Variations on Genetic Algorithms 2.1 Modeling and Simplied Applications . 2.1.1 Rhythm . . . . . . . . . . . . . . 2.1.2 Harmonization . . . . . . . . . . . 2.1.3 Melody . . . . . . . . . . . . . . . 2.1.4 Other . . . . . . . . . . . . . . . . 2.2 General Tools for Artists . . . . . . . . 2.2.1 Timbre Exploration . . . . . . . . 2.2.2 Development of Melodic Material 2.2.3 Interactivity . . . . . . . . . . . . 2.2.4 Compositional Environments . . . 2.3 Applications for Particular Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 2 3 3 4 6 7 8 10 12 12 13 13 14 14 16 17 19 19 20 21 21 23 26 26 27 28

II

III Algorithm . . . . . 3.1 Representation 3.2 Fitness . . . . 3.3 Time . . . . . .

vi

3.4 Reproduction . . . . . . . . . . . . . . 3.4.1 Asexual vs. Sexual Reproduction 3.4.2 Sexual Selection and Mate Choice 3.4.3 Mutation . . . . . . . . . . . . . . 3.5 Output . . . . . . . . . . . . . . . . . 3.6 Compositional Framework . . . . . . . 3.6.1 Location and migration . . . . . . 3.6.2 Environmental Changes . . . . . . IV Conclusion . . . . . . . . . . . . . . . . . . 4.1 Results . . . . . . . . . . . . . . . . . 4.1.1 Test Sets . . . . . . . . . . . . . . 4.1.2 Output Types . . . . . . . . . . . 4.1.3 Sexual vs. Asexual Reproduction 4.1.4 Mutation Functions . . . . . . . . 4.1.5 Number of Generations . . . . . . 4.1.6 Variables . . . . . . . . . . . . . . 4.2 Future Work . . . . . . . . . . . . . . 4.3 Closing Remarks . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

31 31 32 35 40 43 43 43 45 45 45 47 48 50 54 55 56 57 58

Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

vii

LIST OF FIGURES 1.1 1.2 1.3 1.4 1.5 1.6 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 Simple chromosome . . . . . Simple tness calculation . . Sexual reproduction . . . . . Mutation . . . . . . . . . . . Representation of rhythm by Representation of rhythm by . . . . . . . . . . . . . . . . . . . . . . . . . . . . time-slices . duration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4 5 6 9 10 27 28 29 30 30 33 36 37 38 39 39 40 41 42 46 46 49 51 51 52 53 53 54 55

Waveform as chromosome . . . . Fitness function . . . . . . . . . Calculation of error . . . . . . . Fixed-length chromosomes . . . . Chromosomes of arbitrary length Crossover point for waveforms . . Mutation by addition . . . . . . Mutation by amplication . . . . Mutation by exponentiation . . . Mutation by reversal . . . . . . . Mutation by swapping . . . . . . Mutation by elimination . . . . . Mutation by duplication . . . . . Mutation by resampling . . . . .

Sinusoid without mutation . . . . . . . . . . . . . . . . . . . Noise without mutation . . . . . . . . . . . . . . . . . . . . Sexual reproduction of sinusoids . . . . . . . . . . . . . . . . Sinusoid with mutation by amplication . . . . . . . . . . . Noise with mutation by amplication . . . . . . . . . . . . . Sinusoid with mutation by exponentiation . . . . . . . . . . Noise with mutation by reversal . . . . . . . . . . . . . . . . Noise with mutation by swapping . . . . . . . . . . . . . . . Noise with mutation by duplication . . . . . . . . . . . . . . Sinusoid with mutation by reversal, swapping, or duplication

viii

Preface
Genetic algorithms were developed by John Holland in the early seventies [Hol92]. They use an evolutionary metaphor to evolve solutions to problems or model the evolutionary processes. A population of potential solutions work in parallel to nd optimal solutions in a large, complicated search-space. Genetic algorithms are typically used as function optimizers for various sorts of engineering tasks and to investigate a wide range of adaptive processes such as learning, economics, biology, etc. Because genetic algorithms can eectively explore high-dimensional spaces, I believe they have potential application to algorithmic composition. This project investigates the algorithmic composition of tape music. Both the compositional form of this music and the local details of particular sounds will be dictated by the evolutionary process. The compositional form is dened by an algorithmically generated world comprised of multiple, changing environments. Particular sounds will exist in this world. The local details are dened by the process of the sounds migration between environments, their interaction with these environments, their reproduction, and the populations evolution over time. This thesis is organized so that it can be read by someone with no background in biological modeling. The rst chapter provides an explanation of genetic algorithms, develops a simple algorithm that evolves new tuning systems, and describes the impact of user bias on algorithm design. The second chapter reviews research applying genetic algorithms to creative musical applications. The third chapter details a new algorithm for evolving waveform and a stochastic compo-

ix

sitional framework that guides this evolution. The fourth chapter describes the results of the evolution of several dierent populations of sounds using this new algorithm.

Acknowledgements
Without a doubt, this has been the hardest section of the thesis to write. I owe a great deal to a great many people, and gratitude is always dicult to articulatewhat can be expressed often falls short of the mark. When I try to trace this project back to its root, the credit (or blame, if you prefer) seems to center primarily on Greg Moynihan. One day, while I was bemoaning my choice of major, he suggested that I might try Cognitive Science. Another day, while I was expressing frustration at my lack of opportunity for musical expression, he suggested I take some computer music courses. In the cognitive science program, I was introduced to biological modeling by David Zipser. My rst computer music course was taught by Chris Mercer and Peter Otto, who encouraged me to pursue further studies. I have had the good fortune of having an extensive support network of teachers, colleagues, friends, and family. Rand Steiger and Chaya Czernowin have encouraged me as a composer; Peter Otto and Dick Moore have encouraged me as a computer music researcher. Miller Puckette deserves special mention for taking me seriously as a composer and researcher and providing me with much needed support and encouragement in all of my endeavors. My colleagues Joe Sarlo and Ted Apel have been amazing resources, helping me rene my ideas through discussion and directing me to examine areas of the eld that I might have otherwise neglected. Jennifer Edwards, Nina Eidsheim, Marylou Gibson, and Derek Keller (and probably a few others who I am accidentally overlooking) have provided me with moral support which has been no less

xi

important than the intellectual support that I have received. I owe a lot to my family. Lloyd Brown and Ceri Van Slyke have been willing to discuss my project and provide welcome cross-disciplinary perspectives. Mom and Nathan have been willing to sit through and put up with family dinners dominated by the sort of shop-talk that results from computer musicians, philosophers of science, chemical engineers, and geneticists discussing the application of genetic algorithms to music. This project would never have proceeded in quite the same way (think trainwreck) without P.D.s support. He has listened to my ideas, argued with me about them, discussed aesthetics, proofread my drafts, made me coee, made me dinner, and even cleaned up after me on occasions when Ive become too obsessed with xing some bug or nishing some chapter to contribute to my share of the household chores.

xii

ABSTRACT OF THE THESIS Evolving Waveforms with Genetic Algorithms by Cristyn Magnus Masters of Arts in Music University of California, San Diego, 2003 Professor Miller Puckette, Chair

The goal of this research is to explore the use of genetic algorithms to evolve waveforms. Genetic algorithms are introduced with a simple application that evolves novel tuning systems. Past research involving the application of genetic algorithms to musical situations is reviewed. An algorithm is dened that applies genetic algorithms directly to waveforms, rather than to abstract parameters that must be mapped onto some domain. The results of this algorithm are described. A compositional framework that creates compositional structure by stochastically altering the environment in which the waveforms evolve is described. The success of this project is not in this algorithms ability to make a population of sounds sound more like their environment, but rather in its ability to create novel sounds that are intimately tied to the process of their creation.

xiii

Overview of Genetic Algorithms


This chapter provides an introduction to genetic algorithms.1 Typical applications for genetic algorithms are briey described, the implementation of a simple genetic algorithm is developed, the biases inherent in applying genetic algorithms to particular applications are explored, and some specic examples of these biases are examined.

1.1

Typical Applications
There are two common approaches to using articial intelligence for prob-

lem solving. One is to use rule-based systems; the other is to use biological modeling. Rule-based systems have the benet of being explicit and predictable. This can be powerful and ecient in well-dened situations, but not all situations are well-dened. Many problems are too complex to be easily dened; they change in unexpected ways; they have unclear boundaries; etc. Biological modeling tends to be more appropriate for such situations. Biological modeling algorithms, such as genetic algorithms and neural networks, are capable of adjusting themselves to achieve increasingly correct out1 The bulk of this characterization seems to be common knowledge in the eld. Much of my personal background was acquired from undergraduate coursework in cognitive science. Im not sure where to nd original written sources for this characterization, although similar characterizations (also sans citations) can be found in the introductions of most of the sources in my bibliography.

2 puts. This saves users from the tedious task of adding more and more rules to cover special cases and to counteract the unexpected output discrepancies that result from not fully characterizing the problem space. Genetic Algorithms were developed by John Holland [Hol92] in the early seventies. They use an evolutionary metaphor to evolve populations of potential solutions in parallel. Genetic algorithms are well suited for solving adaptive problems because they have the capacity to evolve and adjust to changing environments. An obvious application of genetic algorithms is biological simulation. For example, competing evolutionary models can be explored and compared. Optimization problems, particularly those with large-dimensional search-spaces, are another common application, since genetic algorithms are ecient at reducing error. More importantly, a genetic algorithm can be applied to a problem space about which we know little; this allows us to at least solve the problem and potentially discover something about the space by examining the solution.

1.2

A Simple Genetic Algorithm


Genetic algorithms model the evolution of a population in a particular

environment. Each member of the population is represented by a chromosome that is comprised of a series of genes. Each gene has two or more possible values, called alleles, and is mapped onto a parameter of the problem space. The environment is represented by a tness function that evaluates each individual and assigns it a tness value. Following the evolutionary metaphor, tter individuals have a higher probability of passing on their genetic material to future generations. The tness values of the population members are normalized and converted into probabilities of reproduction. Each ospring is produced by sexually combining two randomly selected parents. The parent chromosomes are split at some crossover point and the rst part of one parent is spliced to the second part of the other. Reproduction is accompanied by some probability that mutation, usually a ipped bit, will occur

3
chromosome

6405

6218

6946

6775

6111

6324

genes

Figure 1.1: A chromosome with six genes. in the ospring. Natural selection acts to preserve benecial mutations; harmful mutations are lost over time. Evolution is allowed to continue for a xed number of generations or until an individual that reaches some requisite tness level is produced. 1.2.1 Representation To clarify this process, suppose that we want to use genetic algorithms to come up with a new, interesting tuning system. To get this system, we will use a genetic algorithm to evolve an ascending scale of eight notes. We can assume that the rst and last note of the scale will be xed an octave apart. This means that each chromosome in population will have 6 genes, one for each intermediate note of the scale. The alleles of these genes will be integers between 6000 and 7200; when divided by 100, these can straightforwardly be mapped to MIDI between C4 (60) and C5 (72) with an oset in cents (gure 1.1). The genes of each chromosome in our initial population will be a random value between 6000 and 7200. This representation is useful because it represents pitch in a perceptually meaningful way but is exible enough to allow evolution of something besides the logarithmic frequency relationships that we are used to hearing in tuning systems. 1.2.2 Fitness The tness function for this application will be quite straightforward. Because we have assigned possible alleles such that the rst gene (k0 ) cannot help

6405

6218 728

6946

6775

6111 213

6324 2578

fitness function: -187

-171

-664

Figure 1.2: The negative intervals of this chromosome are summed and added to 3600 for a tness value of 2578.

but be equal to or greater than 6000, we do not have to include this rst interval in our tness calculation. For each subsequent gene ki , subtract the value of the previous gene ki1 . The result will be negative if the two genes are not in an ascending relationship. We will ignore all positive results, since we dont care about the size of the interval between note as long as they are ascending, then sum the values over the length of the chromosome. Given a worst case scenario in which the values oscillate between 6000 and 7200, this will give us a value of -3600. Because it will simplify later calculations if our tness values are positive, we will add 3600 to the result, bringing our lowest possible tness value up to zero (gure 1.2). This will give us the tness F .
5

Fj =
i=1

(ki ki1 ) + 3600

This gives us tness values between zero and 3600. An individual that perfectly fullls our requirements will have a value of 3600. In order to calculate each individuals probability of producing ospring, we will convert each tness value Fj into a probability Pj . We do this by dividing the tness value of each chromosome by the sum of all tness values in the population. Pj = 1.2.3 Reproduction Once we know the probability of reproducing for each individual, we can produce the next generation. For each individual of the next generation, we Fj N l=0

Fl

6405 a) 7026

6218 6462

6946 7114

6775 6777

6111 6104

6324 7050

6405 b)

6218

6946 6777 6104 7050

c)

6405

6218

6946

6777

6104

7050

Figure 1.3: a) Two parent chromosomes with dotted line representing crossover point. b) Portions of parents to be transcribed to ospring. c) Ospring.

randomly select two parents. Since the chromosomes are 6 genes long, we will set the crossover point to be between the 3rd and 4th genes, at the halfway point. The rst three genes (02) from the rst parent will become the rst three genes of the ospring; the last three genes (35) from the second parent will become the last three genes of the ospring (gure 1.3). The nal step of reproduction is mutation. For each gene, there is some probability, usually very low, that mutation will occur. I dont want to replace genes with random numbers, which might lose any information that the genes may already contain, so instead my mutations will add a random number between -50 and 50 to the mutating genes value. If the result of the mutation would be less than 6000 or greater than 7200, the gene is replaced by a random value (gure 1.4).

a)

6405

6218

6946

6777

6104

7050

b)

6405

6218

6946

6777

6152

7050

Figure 1.4: a) Ospring before mutation. b) Ospring after mutation. Arrow indicates mutated gene.

1.3

Modication to Algorithm and User Bias


The genetic algorrithms used to explore a space reect the users bias.

Although the method is exible enough to be applied to a wide array of problems, the form that this application takes will strongly reect the users intuitions about the domain in question. This is most obvious in the users choice of tness function. If I choose, for example, to use rules from western tonal theory to evaluate members of a population, I am already using a model that cannot be applied to world musics or even to much of the western art music written in the last century. The choice of representation compounds this situation. If I choose to represent music in terms of pitch, I place pitch in a hierarchical relationship to other musical variables that excludes application of the model to musics that stress rhythm, timbre, dynamics, etc., over pitch. This bias is amplied by the users attempts to choose mutation methods that are likely to introduce higher tness, rather than new aws, to the population. Any mutation method I introduce in this way will reect the features in which I am interested. There are many biases built into the above sample algorithm. An obvious one is the assumption that a scale ought to have seven novel pitches, culminating with the rst pitch repeated an octave up. This is an easy assumption for someone trained in western music to makeif I hadnt used seven pitches for simplicitys sake, I most likely would have been inclined towards twelve. This prevents my

7 algorithm from coming up with scales of other lengths that might be interesting to work with. My decision to have a scale that starts and ends on C is a clear outgrowth of years of practicing scales on the pianoalways starting on C of course; perhaps I wouldnt have chosen C if Id played a dierent instrument. I can write this o as a practical consideration because I can always transpose the scale, but my decision says something about my worldview nonetheless. But why does my scale even have to be within an octave? If my goal is to create a new tuning system with it new perceptual experiences, why am I constraining it to an octave? Perhaps it would be interesting to develop a system that repeated every 2 octaves, or every tritone, or over some arbitrary interval that doesnt necessarily t evenly into an octave. All of these assumptions about how tuning systems ought to behave are direct results of my training and aesthetic preferences. 1.3.1 Example of Bias Through the Fitness Function An example of introducing bias through the tness function is seen in a comparison of the work of Moroni et al. [MMZG00] (see 2.2.4) and the work of McIntyre [McI94] (see 2.1.2). Both use tness functions to create harmony, but with dierent goals that can be seen in the type of functions they choose. Moroni et al. are concerned with developing a creative system and use their harmonic tness function as one of its components. Their tness function is based on physical theories of consonance and dissonance. This method attempts to be neutral in that it uses a model of what everyone can physically hear rather than a particular styles denition of dissonance and consonance. Furthermore, it does not dene functional relationships between consonant and dissonant chords, as these are subject to change with style as well. By attempting to avoid stylespecic tness functions, Moroni et al. hope to leave the resultant composition open to inuence by the user. McIntyre is concerned with modeling harmonic production. Because the concern is with modeling, an objective measure of success must be used. This leads

8 to a tness function based on rules of baroque, four-part harmony. This is an ideal function for this purpose because the rules have already been described by theorists and are generally agreed upon. If McIntyre were to use a tness function based on physical theories, there would be no clear answer as to whether or not his system created successful harmonies. A consonant but uninteresting harmonization might be declared successful for being consonant or it might be declared unsuccessful for being musically uninteresting. By using rules from a well-studied style of music, the resultant harmonizations will either clearly follow the rules or they will not.2 1.3.2 Example of Bias Through Representation There are two ways throughout the literature (see Chapter II) in which pitch and rhythmic material are combined. In one, the chromosomes genes represent slices of time, usually sixteenth-notes or eight-notes, and each slice of time contains a pitch or a rest. In the other, each gene is represented by a pitch/duration pair. In the rst case, there is a strong notion of beat. All notes will fall on beats or beat subdivisions. There are two possible ways of interpreting neighboring notes of the same pitch. They can either be considered notes of longer duration, in which case repeated notes cannot be represented, or they can be considered as repeated notes, in which case notes of longer duration cannot be represented. This method of representing time, while being eective in constraining notes to fall on beats, which is important for many styles of music, will never permit triplets or other tuplets.3 Each pitch will be tied to a particular location in time and mutations to particular genes will change pitches vertically but not disrupt the
This is not to say that this method captures the musical style, only that it eectively follows the rules. This is a reasonable way to test the success of the model; we can disagree about its ability to capture style but not about its ability to follow rules. 3 One can imagine extending this method by adding more subdivisions, but it will always be constrained. Since each subdivision adds to the chromosome length, adding subdivisions will explosively lengthen the chromosomes. The computers available memory, not to mention additional processing time, will provide an upper limit to chromosome length and hence the number of subdivisions. Furthermore, by adding too many subdivisions, you lose the beat-constraining benets of this type of representation without gaining the exibility of the second type of representation.
2

a)

4 & 4x x x x x x x x x x x x x x x x 4 & 4q 4 & 4x x x x x x x x x x x x x x x x 4 & 4q q q q q q q q q q q q q q q q

b)

c)

Figure 1.5: a) A 4/4 bar of a chromosome whose genes represent sixteenth-note slices of time. b) This chromosomes output interpreted so that neighboring notes of identical pitch represent longer durations. c) Two mutations to the previous chromosome, resulting in changes to both melody and rhythm. These changes do not aect other notes represented by the chromosome.

temporal location of later notes (gure 1.5). This means that it is highly unlikely that the melodic contour will remain the same while the rhythm changes.4 Because the second case represents each note with a pitch/duration pair, the melodic contour and the rhythm can be evolved with more independence. If the durations permitted by the algorithm are restricted to beats or beat subdivisions, this representation will be constrained to the same sorts of divisions as the previous representation. However, this representation could potentially permit rhythms that are unrelated to some beat structure.5 Another dierence is that this representation allows neighboring notes to repeat pitches without losing the
Since mutations, in this case, are applied independently to individual genes, several unlikely events would have to occur. Each gene after the changed rhythm would have to be selected for mutation. Each mutation gene would have to acquire the appropriate value to shift the melody in the appropriate direction rather than replace it with something else. This is something like expecting monkeys with typewriters to write Shakespeare. 5 Unlike the rst representation, this would not change the length of the chromosome. The available durations would be limited by the number of bits the computer allocates to a oat.
4

10

a)

4 & 4q

b)

4 & 4q q

q q.

q e. q q q q

q q q q q

Figure 1.6: a) A 4/4 bar of a chromosome whose genes represent pitch/duration pairs. b) The gene after the rst notes pitch and rhythm have been mutated. The mutated pitch results in a repeated note, whose repetitions have dierent durations. The mutated rhythm shifts the rest of the measure by a sixteenthnote, changing the position of each pitch while preserving the melodic contour and changing the length of the entire melody.

possibility for notes of varying duration. Unlike the rst case, there is no clear indication of beat. When genes are tied to particular slices of time, a gene is either on the beat or not. If a gene starts out on the beat, it will always be on the beat, and mutation will not change this. This means that events can be consistently tied, for example, to strong beats. In the case where genes represent pitch/duration pairs, this is not the case. If the rhythm of the rst note is altered by mutation, the shift in time will propagate down the gene, potentially causing drastic changes to the overall metrical structure (gure 1.6). 1.3.3 Example of Bias Through Mutation The introduction of bias through mutation results from the designers attempts to introduce domain-specic mutations. Two contrasting examples are seen in the work of Wiggins et al. [WPPAT98] and McIntyre [McI94] (see 2.1.2). While both are attempting to use genetic algorithms to write baroque four-part harmony to an existing melody, Wiggins et al. attempt to build a great deal of knowledge into the mutation operations, whereas McIntyre allows much more freedom. Wiggins et al. provide a list of mutation functions that severely curtail

11 the potential values for each gene. These are perturb, which allows the voice to move up or down a semitone, swap, which swaps the values of two voices, rechord, which replaces a chord with a new one in which the melodic note is either root, 3rd, or 5th, phrase-start, which replaces each phrase beginning with a tonic in root position on the downbeat, and phrase-end, which replaces the end of each phrase with a chord in root position. The bias is clearthe problem space has been arranged so that only high-level mutations relating specically to chords can be used. Only the rechord and perturb mutations will allow the algorithm to explore new harmonies. The rechord mutation assumes that dominant sevenths will never occur, so these can only be reached by the perturb mutation. This is highly unlikely because it can only move by semitones and will have to traverse a great distance through low-tness space in order to survive long enough to reach a higher tness level. The phrase-start and phrase-end functions eectively force a specic structure on the members of the populations rather than allowing them to evolve to some point that might dier from this structure but still follow rules of baroque harmony. McIntyre has one, simple mutation: the mutated pitch can be replaced by any other pitch. This assumes that with enough freedom and a well-designed tness function, the rules of baroque harmony will be successfully implemented by the algorithm. Unlike the perturb mutation function used by Wiggins et al., this function does not require unt individuals to be preserved for multiple generations in order to reach a tter value because notes can jump from one position to another rather than having to move by semitone. Although many mutations will be negative, these will be unlikely to be passed on to future generations. Benecial mutations will happen with enough frequency and be passed on to future generations that the population as a whole will progress towards a higher tness. In this section I have explained how implementing genetic algorithms inherently involves user bias. This will be relevant both in the literature review (chapter II) and in descriptions of my own work (chapters III and IV).

II

Literature Review
2.0.4 Introduction There are many researchers using genetic algorithms in computer music, both as tools for engineering and as methods for achieving creative goals. Engineering applications include designing synthesis systems ([Gar00]), setting synthesis parameters to match particular sounds ([CYH96], [FV94], [Hor95b], [Hor95a], [Hor96], [HB96], [HBH92], [HBH93], [HC95], [VV93]), tuning ([HA96] ), synchronization of sound and animation ([THG+ 93]), recognition ([FF99], [Fuj96]), and evolution of components in systems with more traditional architecture ([Bey99], [Jac95]). We will not address these in more depth here, as our primary interest is in creative applications. Because of the diverse approaches taken towards using genetic algorithms for musical applications, there are several useful ways in which these can be organized. Burton and Vladimirova [BV99] review this literature in terms of the type of tness function used. Here we address the work in terms of the researchers intents. There are several approaches being taken towards achieving creative ends using genetic algorithms. One is to assume that we must rst model creativity in known musical situations before we can approach the much larger task of creating a more comprehensive creative system. Another is to develop tools that perform

12

13 particular tasks that the designer believes will be useful to currently practicing musicians. A third, is to design tools or processes that can be applied to specic creative ends; if they happen to be useful to other practitioners, thats an added bonus, but it is not the primary goal. 2.0.5 Variations on Genetic Algorithms There are two variations on conventional genetic algorithms that are seen throughout the literature: the genetic program and the interactive genetic algorithm. Genetic programs [Koz92] dier from genetic algorithms in that they evolve sequences of functions that act to produce and modify data rather than directly evolving sequences of data. Interactive genetic algorithms replace the tness function with a user who evaluates each member of the population and subjectively assigns a tness value. Because of this, a recurring problem for designers of interactive genetic algorithms is the tness bottleneck. This is essentially the limit of the human capacity to rate each member of the population, resulting from the fact that each member of the population must be listened to in real time, a time-consuming and often tedious process.

2.1

Modeling and Simplied Applications


Many researchers assume that we must tackle simple problems to decide

what will and wont work before investing the time and eort in creating more comprehensive systems. More importantly, solving simple problems helps us to rene our understanding of the processes involved; if a comprehensive system is built from scratch, it is more dicult to discover why the system works the way it does than if it is built from simple parts that have all been individually examined.

14 2.1.1 Rhythm Both Horowitz [Hor94] and Burton and Vladimirova [BV97] explore the generation of rhythm. Their initial approaches are very similar; both represent rhythm in terms of sequences of ones and zeros that occur on discrete time steps. Individuals are collections of voices with dierent timbres that co-occur to build more complex rhythmic textures. What distinguishes their approaches to the problem is their tness functions. Horowitz uses an interactive genetic algorithm. Because interactive genetic algorithms require that users listen to and rate each individual in the population, this can be taxing for the user. To ease the users work-load, higher-level algorithms are used to shrink the search space to be closer to some higher level tness function such as syncopation, density, downbeat, etc. Burton and Vladimirova use an ART (Adaptive Resonance Theory) neural network rather than a user to evaluate the function. ART networks are eective pattern recognizersthey categorize patterns and identify new pattern categories without supervision. Fitness is assigned based on similarity to patterns, with new patterns being designated for individuals that are suciently dierent from existing patterns. 2.1.2 Harmonization Investigations that model harmonization focus primarily on baroque, fourpart harmony. Perhaps this is due to extensive eort that has been made by music theorists to document rules for this style. This means that the bulk of the eort in writing a suitable tness function has already been done. The standard representation is a xed length chromosome with each gene a set of four values, one for each voice. The melody voice is pre-dened and is not subject to mutation. A very simple sub-problem is that of nding the correct voicings of a chord progression. Horner and Ayers [HA95] take this approach. They build knowledge into their system by enumerating every possible voicing of each chord in the progression. The mutation function simply selects another voicing possibil-

15 ity. This enumeration might seem excessive, but the approach so clearly emulates the method taught to music theory students,1 it has a certain ecological validity. Because of its simplicity, the system will almost always nd an answer that satises the tness constraints. McIntyre [McI94] addresses the harmonization problem directly. Rather than encode extensive knowledge of theory into the mutation function, mutated notes are replaced at random by any other note. This approach allows the population to converge relatively quickly. Although the output is rarely completely true to the rules of baroque, four-part harmony, McIntyre seems satised that the results are believable harmonies, consistent with the baroque style. One strength is the ability of the algorithm to nd multiple believable harmonies for a given melodythis is note-worthy since rule-based systems tend to nd the rst result that satises the rules and then stop before nding other potential results. Wiggins et al. [WPPAT98] have attempted to build upon McIntyres work. The authors clearly nd the results dissatisfying and they conclude that only a conventional rule-based system is capable of proper harmonization. It is worth investigating this dissatisfaction in more detail, as the way in which a system fails can tell us much about the system. Wiggins et al. go to great lengths to encode as much knowledge as possible into the mutation functions. Rather than use a simplied version of the codied rules of baroque, four-voice harmony, as McIntyre does, they extend the tness function a great deal. The excessive complexity of their domain-specic mutations hamstrings the genetic algorithm by preventing it from exercising one of its primary strengths: the ability to nd solutions when the path is unclear. By articially limiting the spaces that can be reached by mutation to a list of highly-specic possibilities, Wiggins et al. are presuming that they have already completely codied in their mutation functions every possible operation that might be necessary to achieve correct, baroque, four-part harmony. Because of the preThis might not be the method taught to all music theory students, but it was at least the way I was taught.
1

16 cision of these rules, if any necessary rule was left out, the search space would be so constrained that the population could not reach portions of the space2 that it may need to pass through in order to reach an acceptable tness level. Wiggins et al. make it clear that the only acceptable tness level is perfection and, based on their algorithms failure to achieve perfection, they conclude that genetic algorithms are not appropriate for the simulation of human musical thought. This conclusion is unjustied. First, when their results were graded by a music theory professor, who was asked to grade them as he would his theory students, he gave them a clear pass. Wiggins et al. do not make it clear why they are dissatised with results that seem to please a music theorist. Second, they assume that four-part harmonization in the baroque style, based on an intricate rule-system dened years after-the-fact by theorists, will somehow have clear implications for creativity. Despite the fact that baroque composers did not have the benet of a few hundred years of theory to carve rules in stone for them and therefore often failed to comply perfectly with these post-hoc rules, Wiggins et al. declare that any approach that results in less than perfect compliance with this articial rule-system is an inappropriate model of creativity. For Wiggins et al., any result that breaks even the most minute of rules is unsatisfactory. In taking this position, Wiggins et al. set themselves against contemporary popular wisdom, which holds that the ability to eectively break rules, rather than the ability to perfectly adhere to rules, to be the hallmark of creativity. 2.1.3 Melody There is surprising similarity between the approaches taken to modeling melodic generation by Laine and Kuuskankare [LK94] and Johanson and Poli [JP98]; this is all the more striking given their apparent unawareness of one anothers work. Rather than use a straightforward genetic algorithm, both use genetic programming (see 2.0.5). This allows melodies to vary in length. Because of the
2

Space here is the space of which the search-space is a subset.

17 desire to simplify the problem to one dimension, melodic sequences are represented as a sequence of pitches with no rhythmic representation; all notes are assumed to be the same length, although Laine and Kuuskankare grant that longer rhythms might be represented by sequences of identical pitches. Johanson and Poli use a hybrid approach to tness. The user can rate tness, as with an interactive genetic algorithm (see 2.0.5), or use a neural network to evaluate tness. Unlike the ART network used by Burton and Vladimirova (see 2.1.1), which relies on the properties of the network itself to assign a tness, Johanson and Poli train back-propagation networks with the users past ratings in order to create networks that will rate in a similar manner to the user. These networks use shared weights for scalability so that they can evaluate melodies that vary in length. 2.1.4 Other The papers discussed below go a step further than the papers previously discussed in this section. Although they are still modeling problems, they investigate multiple musical dimensions or alternative uses for genetic algorithms in the context of modeling musical creation. In addition to their eorts in harmonization (see 2.1.2), Wiggins et al. use genetic algorithms to create simple jazz solos with harmonic accompaniment. The solo melodies are represented as a list made up of paired scale-degrees and durations, with non-scale notes forbidden. The harmonic accompaniments are represented by lists of triplets: root, chord type, duration. Unfortunately, as with their attempts at harmonization, the combination of extremely specic mutations and tness functions comprised of large lists of rules led them to disappointing results. Polito et al. [PDBB97] use genetic programming to create sixteenthcentury counterpoint from a user-dened cantus rmus. Rather than evolving a single set of instructions, three sub-populations of instructions are evolved: one for polyphony, one for imitation, and one to select portions of the cantus rmus

18 from which to generate new material. Rather than evolve a lengthy excerpt along a single musical dimension, Gibson and Byrne [GB91] focus on evolving four bars of four-part harmony. Unlike the previous examples that evolve only harmony (see 2.1.2), they evolve rhythm, melody, and harmony. To simplify the problem, the space is restricted to notes in the C major scale and 3 chords: tonic, dominant, and sub-dominant. The problem is broken down and addressed in series. First, a rhythm is evolved, then a melody, then harmony. Instead of a rule-based tness function, each sub-section is graded by a neural-network that has been trained with four-bar segments in the desired style. To provide for global structure, the melodic tness assignment is made by two networks, one that evaluates melodic intervals and the other that evaluates melodic structure. Hrnel and Ragg [HR96] use genetic algorithms more indirectly. Their o research focuses on building neural networks capable of producing and harmonizing simple folk melodies. A classic problem with neural networks is arriving at an ideal network size: a network that is too large will learn quickly but be incapable of generalizing; a network that is too small will generalize to some extent but be unable to solve the problem. A genetic algorithm is used to add and remove weights and units to neural networks to evolve an appropriately sized network that is capable of both learning at an acceptable rate and generalizing. Todd and Werner [TW99] use the context of melodic production to explore the co-evolution of music producers and music critics. Producers represent melodies with a xed-length chromosome of pitches; critics represent expectancy with a transition matrix. Coevolution reduces the ability of creators to nd easy ways to trick a stationary tness function into giving a high score and enhances diversity within the population and over the course of time.

19

2.2
2.2.1

General Tools for Artists


Timbre Exploration There are three basic approaches taken to using genetic algorithms to

explore timbre. One is to modify some initial sound; another is to use genetic algorithms to set parameters for some synthesis technique; the third is to evolve populations of synthesizers that cooperate to create sound events. The rst approach is taken by Horner, Beauchamp, and Packard [HBP93], who begin with an initial sound made with additive synthesis and derive a population with a series of ltering and time-warping operations. These same operations are used as mutation functions. Because this application is designed to help the user nd novel sounds, rather than known sounds, an interactive genetic algorithm is used to direct the course of evolution. The second approach is taken by Johnson [Joh99] and Dahlstedt [Dah01]. Johnson uses interactive genetic algorithms to set parameters for Csound algorithms [Bou00]. To allow the evolution to proceed more quickly, users are permitted to change parameters to help direct the course of evolution. Dahlstedt takes this process a step further by designing an interface that deals abstractly with synthesis parameters from any synthesis system. Two steps are taken to help counteract the tness bottleneck (see 2.0.5). First, parameters that the user is satised with can be saved while allowing the rest of the genome to continue to evolvethis shortens the process by preventing successful settings from being evolved away. Second, an abstract, visual representation of each individual in the population is displayed, allowing the user to use visual information to speed the evaluation process. Bowcott [Bow90] uses biological modeling to generate musical events by granular synthesis. Although this is not explicitly a genetic algorithm, it is suciently similar to be addressed in this section. It can be interpreted as a combination of population modeling, in which the population potentially supports some

20 maximum number of individuals but the actual number of individuals uctuates depending on the distribution of resources, and a modied genetic algorithm, in which reproduction is asexual and mutation is always in a favorable direction. Each grain has a chromosome comprised of its synthesis type, which cannot be modied by mutation, and a list of parameters used to generate an instance of the type. The environment denes factors relating to the survival of various types and how individuals will respond to other grains. The events generated by this process change in time as the evolutionary process unfolds. 2.2.2 Development of Melodic Material Development of melodic material is a dicult prospect and its success depends a great deal on the algorithm-designers success in dening a problem-space in which genetic algorithms can be successfully applied. Ralley [Ral95] attempts to design an interactive genetic algorithm that will develop any melodic idea. It takes a user-supplied melody and uses it to seed a population that is generated based on its statistical properties. The hope is that this will allow the algorithm to be relatively style-neutral. Unfortunately, this approach results in a population with very little biodiversity; as a result, the user has diculty making the subjective tness evaluation. By constraining their domain, Horner and Goldberg [HG91] have more success with their thematic bridging algorithm. It is designed specically for minimalist-style phase music. Rather than use a subjective tness function, the tness function is based on the initial and target melodies and the amount of time that the user would like to have pass between them. Biles [Bil94] also focuses on a particular style, allowing the use of mutation functions that are stylistically relevant. An interactive genetic algorithm is used to generate jazz solos based on a tune. Two populations are used to construct the melody: a population of measures, each made up of eight eighth notes in 4/4, and a population of phrases, that determine how the measures will be arranged.

21 Biles describes the results as competent with some nice moments but is clearly dissatised with the time-consuming nature of the training process. Biles and Eign [BE95] attempted, with equivocal results, to address the tness bottleneck by designing a system that allows multiple users to work in parallel to rate the tness of members of the population. 2.2.3 Interactivity Given current processor speeds, the use of conventional genetic algorithms for interactive applications is still impractical if the result of some number of generations rather than the process itself is the desired output. Biles [Bil98] attempts to do something of the sort by extending his previous work (see 2.2.2) to work in a real time situation in which the program trades four bars with a live musician. Although the program clearly grew out of work with genetic algorithms, in this instantiation there is a population of one that asexually reproduces, with no tness measure and liberal mutation, to produce one ospring in real-time. It is essentially no longer a genetic algorithm; it is a process for directly deriving new material from from a seed by a series of mutations. Spector and Alpern [SA94] approach the same problem using genetic programming. Because the evolved program can run in real time, the time-consuming evolutionary process does not have to occur between the programs input and output, as it would have to if a conventional genetic algorithm were used. 2.2.4 Compositional Environments Designing compositional environments is an inherently more complex task than those previously described, as it involves some combination of the above elements. Some unied system for codifying the various musical elements must be developed, along with appropriate forms of mutation. Furthermore, it should be designed with the awareness that the environment will be appropriate only for a certain subset of musical styles.

22 A simple environment, designed by Degazio [Deg97], uses genetic programming to evolve MIDIFORTH processes that produce compositions. The tness function combines objective tness functions, such as following species counterpoint rules, harmonic correctness, or meeting particular statistical criteria, with the subjective user choice of the interactive genetic algorithm. For each generation, the rst parent is chosen from a set of 3 individuals designated by the user; the second parent is chosen from the entire population based on the objective tness function. This substantially decreases the tness bottleneck while allowing the user to direct the course of evolution. Although this seems stylistically neutral in that the user can use statistical criteria rather than the style-specic tness options, it is still restricted to styles of music that can be produced with MIDI and can be eectively dened by the statistics used by the system. Thywissen ([Thy96], [Thy97], [Thy99]) tries to dene a comprehensive framework for musical evolution. This is clearly a futile process, as numerous decisions contrary to this goal must be made in the design process (see 1.3). The system uses genetic algorithms to evolve components of a composition such as melody, rhythmic structure, harmony, instrumentation, and form. Genes are mapped onto a grammar that has been supplied by the user either as a series of rules or through importing an existing composition as a MIDI le. A hierarchical model separately evolves phrases and systems. A conventional genetic algorithm evolves phrasessequences of notes and chords with their associated rhythms and dynamics. Systems are series of phrases evolved through genetic programming; the possible operators are transpose, retrograde, invert, augment/dimmute, and grow. Although this seems to be fairly neutral, in that a user has stylistic control over the resulting composition, it is clear that this system applies only to the subset of styles that deal centrally with melody, harmony, rhythm, and xed formsit is inappropriate for styles that focus on timbre rather than pitch, have open forms, or incorporate visual elements; it almost certainly cant handle text-setting, and musique concrete is out of the question.

23 The system designed by Manzolli, Moroni, et al. [MMZG99], [MMZG00] does not attempt to be stylistically neutral but instead seems to embrace the notion of an algorithmic compositional system whose output, although guidable by the user, has a distinctive characteristic that is directly related to its processes. The system works in real time, sending output via MIDI, and its rhythm is determined by the length of the generational cycle, which can be altered by the user in realtime. The population is made up of four-note chords, but unlike the harmonization attempts above (see 2.1.2), it relies on physical theories of consonance for its harmonic tness function. Two other tness functions are used in conjunction with the harmonic tness function: melodic and vocal-range. The melodic tness function is based on distance of notes from some tonal center or attractor; the vocal-range tness function veries that the notes of the chord fall within voiceranges set by the composer. These two tness functions can be set by the user in real-time, allowing the output to be sculpted by the user.3 Although the user has considerable leeway in personalizing the output, the sound of the algorithm will always be heard in the rhythm (which comes directly from the generation length), in the types of harmonies evolved (which come directly from the consonance model used), and in the tendency to converge towards the melodic tness functions tonal center (when it remains stationary for a sucient length of time).

2.3

Applications for Particular Works


Unlike the examples of the previous section, the research presented here

is not intended to result in models or tools that can be used and expanded upon by future research, but rather to create particular musical works that are generated by genetic algorithms that have been specically designed for a work or series of works. My own investigations fall into this category and are described more thoroughly in chapter III. These algorithms are almost always heavily modied from
Although its designers identify the system as primarily compositional, which it is, this system might well be considered as a successful implementation of an interactive performance system as well.
3

24 conventional versions of the algorithm, relying often on complicated environments and interactions between individuals. Waschka [Was99] describes a process used to produce a series of pieces. The population is seeded by some initial musical material. Two strategies are employed to retain biodiversity. First, tness is unrelated to an individuals characteristics; it is assigned randomly. Second, individuals can skip generations. Each generation of individuals produced by the algorithm is heard in succession. Although a great deal of the form is produced by the evolutionary process, the resultant works are individual enough to merit the algorithms use to create a series of pieces rather than one because of the composers inuence over the initial musical material. Brooks and Ross [BR96] describe a piece by Brooks in which the algorithm is modied by giving creatures activity-states. Creatures randomly rest, forage, or mate. A resting creature is silent, while a mating or foraging creature produces music, dierent for each activity-state, from the set of characteristic chords and melodic phrases that are dened by its chromosome. Rather than each individual in the generation reproducing at once, an individual will only mate if its mating cycle coccurs with the mating cycle of another individual in its generation. This o causes the generations to overlap, which results in signicant textural dierences, as each generation is mapped onto a dierent instrumental voice. Dahlstedt and Nordahl [DN01] describe not a particular piece but a biological simulation with a distinctive musical byproduct. The genetic algorithm is modied by giving each individual two genes and by replacing the tness function with a square lattice in which individuals and resources occupy space. The two chromosomes are a sound chromosome, which is a list of the individuals preferred notes, and a procedural chromosome, which is a list of instructions dening the individuals actions in the world. One of these instructions is a sing instruction, that causes the individual to produce a note from its sound chromosome. Sound exists in a square and dies out over time. Creatures with more life pointsthese

25 are acquired by entering a square containing foodproduce louder sounds than creatures with fewer life points. Creatures with enough life points can mate, so long as a nearby creature has recently heard a sound from its sound chromosome. An individual can survive reproduction, but a portion of its life points is removed to create the ospring. As the process unfolds, patterns occur resulting from the layers of many individual movement and sound production patterns. These change gradually as the makeup of the population changes.

III

Algorithm
This chapter describes the implementation of an algorithm that uses genetic algorithms as the basis for a process that will be used to produce a series of tape pieces. This algorithm will allow the composer to read in a set of waveforms that will dene the initial population and dene the rules that govern the world in which these waveforms exist and evolve. The primary motivation for this work is to develop an algorithm that works directly on digitized waveforms to create music whose local and global form are products of the same process: evolution in a changing environment. I believe that this process is capable of producing novel and interesting compositions and that the process will be perceptible in these works.

3.1

Representation
As discussed in chapter 2, the chosen representation strongly reects the

biases, or perhaps in this case the aesthetics, of an algorithms designer. In this case, I have no desire to deal directly with pitches, loudnesses, or rhythms, but rather to deal with concrete sounds. The algorithm proposed here uses waveforms, read in from standard audio les, as chromosomes. This leaves us with the problem of dening genes in a meaningful way. It is intuitively obvious that using instantaneous samples as genes is a bad idea: sexual reproduction will introduce clicks; mutation will result in introducing noise. To allow genetic operations to

26

27

Figure 3.1: This waveform is a chromosome. The genes have been delineated by dashed lines.

function meaningfully, we will dene each gene as a segment of waveform between two zero crossings is a gene (gure 3.1). This means that chromosomes will not have a xed number of genes: a low pitched portion of a chromosome will have fewer genes than a high pitched portion of a chromosome.

3.2

Fitness
Our tness function can incorporate both specic waveform features and

general features of the population. In the current version, the user can specify a target waveform or amplitude envelope (gure 3.2). An individuals error is calculated by summing the dierence between the desired amplitude and the actual amplitude for each sample in the individuals chromosome. As expected, when only an amplitude envelope is used, members of the population tend to take on similar envelopes. In the case of the target waveform, both frequency and envelope elements from this waveform tend to appear in the population. In the future, we could add the ability to use time-based spectral features as part of the tness function. By incorporating general features of the population into the tness criteria, we can encourage biodiversity. Currently, an individuals tness drops after childbirth, decreasing the chances that the ospring from a handful of individuals will dominate the next generation.

28

a)

b)

Figure 3.2: a) Fitness function dened by waveform. b) Fitness function dened by amplitude envelope.

3.3

Time
Given this context, there are two distinct ways in which this algorithm

will deal with time. The rst, which has already been implemented, is to allow only xed length chromosomes. In this case, by xed-length, we mean a xed number of samples, or a xed duration, rather than a xed number of genes. This results in discrete generations whose members all begin and end simultaneously (gure 3.4). The second, which will be implemented later, allows individuals to have arbitrary lengths that lie within some xed upper bound (gure 3.5). Fixed-length chromosomes have the benet of being simple to code while still providing interesting results, making them ideal for early proof-of-concept. Because genes can last varying lengths of time, the crossover point for sexual reproduction is indexed by time, rather than number of genes, then rounded o to the nearest zero crossing. The drawback of using xed-length chromosomes is that the discrete generations become an unchanging rhythm. The arbitrary-length

29

a)

b)

c)

d)

Figure 3.3: a) A waveform-dened tness function (dotted line) is superimposed on an individual waveform (solid line). b) The shaded area is equal to the individuals error in the case of a waveform-dened tness function. c) An amplitude-envelopedened tness function (dotted line) is superimposed on an individual waveform (solid line). d) The shaded area is equal to the individuals error in the case of an amplitude-envelope-dened tness function.

30

Figure 3.4: Three discrete generations of waveforms (solid lines) with superimposed tness function (dotted lines).

Figure 3.5: Three time-varying generations of waveform (solid lines) with superimposed tness function (dotted lines). The tness function is stretched and compressed in time to match each waveforms duration.

31 method allows individuals from dierent generations to overlap, since they end and are replaced independently of the rest of the population.

3.4
3.4.1

Reproduction
Asexual vs. Sexual Reproduction Reproduction is the process by which a generation is derived from the

previous generation. Currently, either asexual or sexual reproduction can be used. In the case of asexual reproduction, members from the population are randomly selected to be copied directly to the next generation. Because tter members have a higher probability of reproducing, the next generation will have more copies of the tter members of the population. Members of the population with low tness will be very unlikely to continue to the next generation. In the case of asexual reproduction, new material can only be introduced by mutation (see 3.4.3) so biodiversity decreases rapidly. Sexual reproduction splices genetic material from two individuals to produce one individual in the next generation. Sexual reproduction fosters more biodiversity than asexual reproduction; no ospring will be the clone of a parent. For each member of the population, there are twice as many opportunities to pass on genetic material to the next generation. Because ospring combine material from two parents, there is the potential for combining tter portions of two individuals and losing the less t portions. There is still the possibility that in an individual, the less t portions of t individuals will be preserved and the t portions will be lost, but in the next generation these individuals will be unlikely to reproduce, increasing the chances that the t genetic material will be passed on to further generations. For each ospring, two parents are selected from the population. The probability that an individual will be selected as a parent is based on its tness. Ideally, we will divide the parents at a crossover point at the center of the chromo-

32 some and take the rst part of one parent and the last part of the other parent. Depending on how we are treating time, this could mean two dierent things. In a classic genetic algorithm, chromosomes are xed length and the crossover point is in the middle, with half of the genes on either side. In the xed-length chromosome case for waveforms, however, this doesnt work. The length is dened by duration, rather than genes. Low pitched genes will be long, high pitched genes will be short. Instead of dening the crossover point as having half of the genes on one side and half on the other, we dene the crossover point as being the middle in terms of duration. Since this might occur in the middle of genes, we will adjust the crossover point for each parent independently so that it occurs on a zero crossing (gure 3.6). In the case of chromosomes of arbitrary length, we can choose to dene the crossover point as either the duration-based crossover point, a gene-based crossover point, or an arbitrary crossover point. With the duration-based crossover point, we will dene the crossover point for the two parents independently such that half of each parent is combined. With the gene-based crossover point, the rst half of the genes from one parent will be combined with the second half of the genes from the other parent. This will lead to interaction between pitch and duration. With an arbitrary crossover point, we will take an arbitrary length from the beginning of the rst parent and an arbitrary length from the end of the second parent. This means the duration can be as short as some lower bound or as long as the combined duration of the two parents. 3.4.2 Sexual Selection and Mate Choice Although it is an improvement over asexual reproduction, sexual reproduction still converges relatively quickly. In nature, there are selection pressures beyond the environment. Sexual dimorphism, for example, is the direct result of psychological factors acting to determine which individuals get to reproduce. Miller and Todd [MT95] discuss the benets of sexual selection and its poten-

33

a)

c)

d)

b)

e)

Figure 3.6: a) Two parent waveforms with dotted line representing ideal crossover point. b) Crossover point corrected to line up with zero crossings. c) Portions of parents to be transcribed to ospring. d) Ospring waveform. e) Ospring chromosome truncated for xed-length case.

34 tial for enhancing traditional genetic algorithms. It has the potential to speed optimization, allow populations to escape local minima, and possibly even allow populations to undergo sympatric speciation. Sympatric speciation is the process by which a single species diverges into two species within a single, contiguous environment. From our perspective, this is perhaps the most interesting. Through sympatric speciation, we can have not only increased biodiversity, but also distinct sub-populations that in this context can create a sort of polyphony. In the future we hope to implement gender and sexual selection. To do this, we will add more genetic material to our description of each individual. Each individual will have a gender eld that declares that individual to be male or female. Each individual will have a preference chromosome that represents that individuals preference function (analogous to the tness function) by which it will gauge the appropriateness of a mate. Each individual will have a pickiness level that determines how much deviation from its preference function it is willing to accept in a mate. Miller and Todd propose several types of preference function. In the rst, each individual prefers individuals similar to itselfwe can avoid the extra preference chromosome in this case. In the second, the preference is inherited. In another, individuals prefer mates most similar to their parent of the opposite sex. For each ospring, a female is chosen randomly from the population. As before, her probability of being chosen is based on her tness. Next, a male is chosen randomly by the same process then evaluated based on the females preference function. If his error is less than her pickiness, she will mate with him. If his error is greater than her pickiness, a new male will be randomly selected. This process continues until an appropriate male is found or she is deemed to be too picky and discarded in favor of a new female. The ospring will be assigned a random gender and will inherit pickiness from one parent. The pickiness gene will be subject to some probability of mutation. This mutation will add or subtract a very small amount to the pickiness. In

35 the case in which the preference chromosome is inherited, it undergoes the same process of crossover and mutation as the waveform chromosome. In the case in which individuals prefer mates most similar to their parent, the parents genetic material will be copied into their preference chromosome. 3.4.3 Mutation Mutation allows changes to be introduced into the population. This introduces genetic material that will allow the population to reach a higher level of tness than it could using only the genetic material available within the initial population. We have dened several types of mutation, each of which has a constant probability of occurring after reproduction. In the future, we hope to dene probability of mutation using functions that will incorporate features of the environment or population. As stated above, the types of mutation used for waveforms where segments between zero crossings are treated as genes must necessarily be dierent from the types of mutation that are used for more typical applications. The mutation types that most closely resemble the mutation used in a classic genetic algorithm are additive, amplifying, and exponential mutation. The other mutation types (inversion, transposition, elimination, duplication, and resampling) are based on operations commonly used to manipulate waveforms. In the classical genetic algorithm, the chromosome is a string of bits. Each bit is a gene and these genes are mutated simply by toggling the bits. In typical extensions of the classic algorithm, genes are integers or oats that are mutated by adding or subtracting. To extend this concept to waveforms, we can add something to a gene. Obviously we cannot add a constant, as this would only add a click to the beginning and end of the gene without changing its character. Instead we must nd something that is meaningful to our domain. Two obvious choices are to add noise or sinusoids to genes selected for mutation (gure 3.7). The noise case is straightforward. For each sample of the

36

a)

b)

Figure 3.7: a) Ospring before mutation. The portion of the chromosome selected for mutation is delineated by dotted lines. b) Ospring after mutation in which a random sinusoid has been added to selected genes.

gene, add or subtract a random number within some predened range. For the sinusoid case, we need to select sinusoids whose values will be zero at the endpoints of the segment of waveform to be mutated. This means that we can randomly select any multiple of the frequency whose wavelength is the length of the gene. This restricts us to adding partials of a particular harmonic series to each gene. To increase our chances of adding dierent frequencies, we can allow the mutation to be applied to chunks of genes rather than individual genes. In the future, we might extend the concept of mutation by addition/subtraction with ltering. Another extension of this concept is to adjust the amplitude of the gene (gure 3.8). We can multiply genes by a number randomly selected from between predetermined bounds. If the number is greater than one, the gene will be amplied; if it is less than one, the gene will be attenuated. A further extension raises genes to a power that is randomly selected from between predetermined bounds (gure 3.9). To prevent the exponentiation from severely amplifying or attenuating the segment being mutated, each segment is normalized after exponentiation such that it retains its original maximum amplitude.

37

a)

b)

c)

d)

Figure 3.8: a) Ospring before mutation. The portion of the chromosome selected for mutation is delineated by dotted lines. b) Ospring after mutation in which selected genes have been amplied. c) Ospring before mutation. The portion of the chromosome selected for mutation is delineated by dotted lines. d) Ospring after mutation in which selected genes have been attenuated.

38

a)

b)

Figure 3.9: a) Ospring before mutation. The portion of the chromosome selected for mutation is delineated by dotted lines. b) Ospring after the amplitude selected genes has been raised to a power.

In addition to extending the classic genetic algorithm mutation, we can develop mutations that are meaningful for our domain by examining operations commonly applied to our domain. Most waveform editing software will allow the user to reverse, cut, paste, loop, and resample. We have chosen analogous operations that can be applied at the level of the gene or small collection of genes. The two operations that most strongly retain the character of the original sound are reversal and swapping. Reversal straightforwardly reverses a gene or collection of genes (gure 3.10). Neighboring genes or neighboring collections of genes can also have their positions swapped (gure 3.11). The use of mutation operations that change the length of the chromosome as well as its content will be eective in exploiting diering chromosome lengths as a mechanism for adding musicality to the resultant sounds. The elimination mutation cuts a gene or a collection of several genes from the chromosome (gure 3.12). Because this type of mutation shortens the chromosome, it can only be used in the case of chromosomes with varying lengths. The lengthening analog of this, which duplicates a gene or collection of genes, can be used in either case. The duplication mutation duplicates a gene or a collection of genes up to a predetermined

39

a)

b)

Figure 3.10: a) Ospring before mutation. The portion of the chromosome selected for mutation is delineated by dotted lines. b) Ospring after mutation in which selected genes have been reversed.

a)

b)

Figure 3.11: a) Ospring before mutation. The portion of the chromosome selected for mutation is delineated by dotted lines. b) Ospring after mutation in which selected neighboring genes have been swapped.

40

a)

b)

Figure 3.12: a) Ospring before mutation. The portion of the chromosome selected for mutation is delineated by dotted lines. b) Ospring after mutation in which selected genes have been dropped. This mutation type is not used in the xedlength chromosome case.

number of repetitions (gure 3.13). The re-sampling mutation changes the duration of a gene or collection of genes. The magnitude of this change is determined by randomly selecting a new duration that is within some user-dened multiplier of the original duration (gure 3.14). If the multiplier is greater than 1, it will increase the duration of the gene and hence the duration of the chromosome. If the lower bound of this multiplier is less than 1, the mutation can decrease the length of the chromosome and is only permitted in the case of chromosomes with varying lengths. When mutations that increase the length of the chromosomes are applied in the xed-length case, any excess material is truncated.

3.5

Output
The programs output, although perhaps less ideologically loaded than

its input representation, nonetheless deserves mention. Currently, generations of output are concatenated onto a single audio le that represents evolutionary pro-

41

a)

b)

c)

Figure 3.13: a) Ospring before mutation. The portion of the chromosome selected for mutation is delineated by dotted lines. b) Ospring after mutation in which selected genes have been duplicated. c) Ospring chromosome truncated for xedlength case.

42

a)

b)

c)

Figure 3.14: a) Ospring before mutation. The portion of the chromosome selected for mutation is delineated by dotted lines. b) Ospring after mutation in which selected genes have been resampled by a random amount. c) Ospring chromosome truncated for xed-length case.

43 cess over time. This reects my intention to use this as a process piece. I also allow individuals to be written to audio les as the evolution progresses, which can facilitate the algorithms use for producing interesting sounds for other applications. For cases in which evolution seems too slow, the user can skip generations in writing output. The user can also dene the type of output: outputting either the ttest member of the population, a random member of the population, or all members simultaneously, weighting each member by its tness.

3.6

Compositional Framework
Now that the method for generating material has been dened, we need

a way of dening a piece of music. From the beginning of this project, my primary goal has been to produce a series of pieces from a process where the form of the piece is derived from the process itself. Evolution does not occur in a vacuumthe world is constantly changing. We will dene the characteristics of this world and allow the process described above to unfold within it. Variations between pieces will be encouraged by varying initial conditions. 3.6.1 Location and migration For a given piece the world will be characterized by some number of locations. These locations may be mapped spatially onto speakers. These locations will initially be dened by some environment. Individuals within the population will have some probability of migration. In this way, sounds with new characteristics will enter locations, enhancing biodiversity. 3.6.2 Environmental Changes The world will be characterized by probability of change. There are two sorts of changes that environments can undergo. One is the slow drift that we see in ice ages: these take place over an enormous amount of time from the perspective

44 of individuals but happen many times over the evolution of a species. The other is the drastic change that we see resulting from catastrophic events, such as re decimating a forest, causing it to be replaced by grassland. The form of these pieces will be the process of evolution in an ever-changing world.

IV

Conclusion
This chapter describes the data used to test the algorithm, the results of the algorithm, general issues that arose from the testing, and future work.

4.1

Results
Because of the subjective nature of this work, it is dicult to quantify

the results. Test sets will be dened, resulting output will be described, and generalizations will be made. 4.1.1 Test Sets Because the ultimate goal of this algorithm is to produce interesting music, two dierent types of test sounds were used. Simple populations and environments were used to try to hear how the algorithm was working and real-world populations and environments were used to verify that the algorithm produced musically interesting results. The simple environment was a glissando, of constant amplitude, sweeping from middle C up an octave. Two simple populations were used. The rst was comprised of sinusoids of varying amplitudes (see gure 4.1). The lowest pitch was middle C and the pitches ascended by half-step to the B above. There were four

45

46

Figure 4.1: An individual from a population of sinusoids in an environment dened by a glissando tness function. The dotted line represents the tness function.

Figure 4.2: An individual from a population of noise in an environment dened by a glissando tness function. The dotted line represents the tness function.

amplitudes for each pitch: 100dB, 95dB, 90dB, and 85dB. The second population was comprised of samples of noise, each with the same amplitude (see gure 4.2). The real-world environment was the sound of a bell. A real-world population was generated by sampling arbitrary portions of a musical composition for percussion and two vocalists.1 This population is interesting because some of its components are quite similar to the environmental sound while others are not. I expect to see an interaction between the entirely arbitrary amplitude envelopes of the selected population members (these dont always fall on the attack) and the amplitude envelope of the environment (a single attack that is allowed to ring for some time). We might also expect to see some interaction between the pitch and timbre of the populations and that of the bell. Would sections played by the
Pantomime Grasshopper (2002) by Cristyn Magnus, performed by Nicholas Hennies, Anne-Marie Dicce, and Rebecca Harris on October 12, 2002.
1

47 percussionist be tter than sections sung by the vocalists because his instruments are inharmonic? Or would the vocalists be tter if they happen to sing pitches that are prominent in the tail of the bell sound? 4.1.2 Output Types With each generation, a snapshot of the population is appended to an output le. These snapshots can take several dierent forms: ttest, random, or weighted. The ttest snapshot writes only the ttest member of the population to the output le. The random snapshot writes a random member of the population to the output le. When the weighted snapshot is used, each individual is weighted by its tness; the weighted population is summed and written to the output le. The ttest and random snapshots dier early in the evolutionary process, but as biodiversity decreases, their output is perceptually indistinguishable. Features from the initial population can be clearly identied throughout. In the random case, these change drastically over the rst several generations until the population converges to a few features common to all individuals. In the ttest case these change somewhat, but it is rare to see a run in which one or more particular features are not common to all generations of the output. Once the population has converged, the output is repetitive and varies from this set of inherited features only when prominent mutations occur. Often these are lost to subsequent generations due to lack of tness or random drift. Occasionally these mutations contribute signicantly to tness and can be heard to persist in the population. The weighted output reects aspects of the entire population. Fit individuals are more prominent in the output, but no one individual dominates. Because the initial biodiversity is very high, the beginning of the output le is a wash of textures reminiscent of the timbres of the initial population. Within a few generations, a few t individuals dominate the mix, causing a sound in which particular features of the initial population can be identied. The eect of the weighted summing is that the resultant output more closely resembles the environment than the

48 ttest individual does alone. After several generations have passed, all members of the population inherit the same basic set of features from the initial population. At this point, the type of mutation being used (see 4.1.4) signicantly impacts the resulting sound. This interacts with the summing process because individuals have very similar tness levels and no one individual is in the position to dominate. After this point, the population as a whole can be heard change gradually but perceptually, but not always with a strong directionality. 4.1.3 Sexual vs. Asexual Reproduction The primary dierence between asexual and sexual reproduction is this: populations undergoing asexual reproduction rely on the ability of individuals to reach higher levels of tness through mutation; populations undergoing sexual reproduction combine the progress made by multiple individuals (see 3.4.1). A population reproducing asexually ultimately converges to the ospring of a single individual from the initial population. Because of the perceptible similarity to the initial population, this is an eective way to hear the results of individual mutations. Sexual reproduction combines the progress towards higher levels of tness made by two parents. With a xed crossover point, the population converges to the ospring of two individuals from the initial population.2 The perceptibility of this combination of sounds depends on the initial population. In the case of the population of sinusoids evolving in the environment of a glissando, the rst half of this ospring will be a low-pitched sinusoid and the last half will be a high-pitched sinusoid (gure 4.3). In the case of a population of noise in the same environment, the crossover is virtually imperceptible because of the similarity of individuals in the initial population. With the real-world populations, the perceptibility varied depending on the two parents selected, but the juxtaposition was obvious given
Some mutations (reversal, swapping, and duplication) can potentially cause genes to move from one side of the crossover point to the other. On these occasions, it is possible for a few genes from an individual whose ospring will otherwise die out to be present in later populations.
2

49

Figure 4.3: The typical result of sexual reproduction without mutation. The dotted line represents the tness functionin this case a glissando from low to high. The dashed line represents the crossover point. The rst part of the resultant waveform is a low-pitched sinusoid; the last part is a high-pitched sinusoid.

sucient familiarity with the initial population. Sexual reproduction with a random crossover point converges much more slowly than sexual reproduction with a xed crossover point. It ultimately converges to a population of individuals that are descended from multiple members of the initial population. General characteristics from the initial population are present in this sound, but specic sound events that can be identied in the xed crossover case are more dicult to identify. For example, when the population of real-world individuals evolve in the environment of a bell sample, with a xed crossover, specic events, such as a particular pitch and phoneme being sung or a particular instrument such as a wood-block or a cymbal being struck, can be clearly identied. With a moving crossover, the resultant sound has some characteristics of these sounds but they are denatured. The moving crossover point also introduces a few artifacts into the sound. The crossover point is shifted to assure that it occurs on a zero-crossing. This has little eect when only the ttest individual in the population is chosen for output, but a noticeable aect on the results when the tness-weighted versions of all individuals are output. As the population converges, all members are similar but slight delay is introduced at each crossover point. Because the positions are random and genes can be shifted in either direction, copies of genes are shifted to

50 the right or left to varying degrees. This results in the eect of multiple shifting comb lters that fade in and out. 4.1.4 Mutation Functions Each of the ve, fully implemented, mutation functions (see 3.4.3) results in a characteristic output.3 In general, qualities from the initial population are preserved and qualities of the environment and of the mutation functions are added to the output as evolution progresses. Multiple mutation types can be used at the same time, but for clarity we will only consider the results of their use when applied alone. Because all populations eventually converge to a pool of similar individuals, we can describe the results of a mutation in terms of the eect that the mutation has on this pool in conjunction with the tness function. That is, we describe the results of mutation over time, discarding the inevitable mutations that reduce tness. Mutation by Amplication Mutation by amplication changes the amplitude envelope of the population in two ways. As expected, the amplitude envelopes of individuals in the population will tend towards the amplitude envelope of the environment. However, frequencies that are in similar phase with frequencies in the environment will tend to be amplied as well. This interaction with frequency is most obvious in the case of the population of sinusoids evolving in the environment of a glissando of constant amplitude (see gure 4.4). When this population reproduces asexually, a single pitch is heard. Initially, this pitch is heard at a constant amplitude, but after several generations it is perceptibly louder at the point where its frequency and phase coincide with the frequency and phase of the environment. After a longer
Mutation by addition was not tested here, as it has not been fully implementedit currently adds only noise, rather than either sinusoids or noise. It was initially implemented for a proof of concept in which a population of noise evolved in the environment of a sinusoid. The population successfully evolved to a noisy version of the environmental pitch.
3

51

Figure 4.4: Typical results of the long-term evolution of sinusoidal individuals undergoing mutation by amplication in an environment dened by a glissando tness function.

Figure 4.5: Typical results of the long-term evolution of noise undergoing mutation by amplication in an environment dened by a glissando tness function. (See gure 4.2 for the original waveform.)

period of evolution, it has been sculpted into a periodic beep. With more complex sounds, this eect is present but less obvious (see gure 4.5). Mutation by Exponentiation Mutation by exponentiation essentially adds partials to segments of the waveform. This mutation interacts with the tness function in a similar manner to the amplifying mutation. In general, it is applied primarily to genes that fail to fall into phase with the tness function (see gure 4.6). Genes that contribute negatively to tness tend to be exponentiated repeatedly. Because all values are fractional, the repeated exponentiation pushes these genes to zero. This form of

52

Figure 4.6: Typical results of the long-term evolution of sinusoidal individuals undergoing mutation by exponentiation in an environment dened by a glissando tness function.

mutation is the most invasive. Because it signicantly alters the timbre of the initial population, as the population converges the characteristic sounds of the initial population tend to be lost. Mutation by Reversal The quality of mutation by reversal depends largely on the number of neighboring genes chosen for mutation. When a large number of neighboring genes are grouped together, recognizable portions of the individual waveforms are reversed (compare gure 4.2 with gure 4.7). When a small number of genes are grouped together, the degree to which the reversed portion of the sound can be recognized is substantially decreased. Regardless of whether or not the reversed sound can be recognized as the reversed form of a particular sound (e.g. the reversed sound of a snare drum being struck), the reversed portions of the sound can be identied as having been reversed. Mutation by Swapping Mutation by swapping has less eect on the actual timbre of the resulting population than any other mutation. As with reversal, the number of neighboring genes grouped for mutation has a signicant impact on the way the mutation func-

53

Figure 4.7: Typical results of the long-term evolution of noise undergoing mutation by reversal in an environment dened by a glissando tness function. (See gure 4.2 for the original waveform.)

Figure 4.8: Typical results of the long-term evolution of noise undergoing mutation by swapping in an environment dened by a glissando tness function. (See gure 4.2 for the original waveform.)

tions. When a large number of genes are grouped together, recognizable segments are moved throughout the le (compare gure 4.2 with gure 4.8). In the case of the real-world population and environment this might mean shuing attacks or loud portions of sounds to the bells attack and moving sustained vocal sounds and the tails of percussive sounds to ll out the bells tail. When a small number of genes are grouped together, the resultant sound is more homogenized. Instead of few identiable sounds being concatenated to form a particular part of the bells sound, these sounds can be more nely arranged. They will more closely resemble the bell sound because in this situation it is easier to get a favorable mutation without carrying a few unfavorable genes with it.

54

Figure 4.9: Typical results of the long-term evolution of noise undergoing mutation by duplication in an environment dened by a glissando tness function. (See gure 4.2 for the original waveform.)

Mutation by Duplication In most cases, duplication seems to be the most eective mutation in terms of matching the tness function in a convincing way. In the case of a population of noise evolving in a glissando environment, the duplication of a few neighboring genes eectively adds pitch to the population (see gure 4.9). With the mutation applied to larger numbers of neighboring genes, recognizable portions of the sounds can be duplicated. The eect of the latter three mutations on the sinusoidal population is unusual. Each gene is symmetrical and, except for sign, identical to every other gene in the same individual. Because of this, the three mutations are functionally the same in this context. They can cause a change of sign if an odd number of neighboring genes are selected for mutation but otherwise have no eect (see gure 4.10). This change of sign eliminates a zero-crossing, combining two genes into a single, longer gene. This combining of genes occurs for any population when odd numbers of neighboring genes are mutated. 4.1.5 Number of Generations The algorithm was tested for short runs of 50 generations and longer runs of 5000 generations. In all of the short runs, the population converges well before

55

Figure 4.10: Typical results of the long-term evolution of sinusoidal individuals undergoing mutation by reversal, swapping, or duplication in an environment dened by a glissando tness function.

the end of the run. Upon convergence, the output is fairly repetitive. To understand how evolution progresses over the longer term, it is necessary to examine the longer runs. After the early convergence, the progress towards higher tness continues, but at a much slower rate. This is quite clear with the population of noise evolving in a glissando environment. The timbre of the noise changes slightly and somewhat unpredictably with each generation. Sometimes pitchiness is added; sometimes it is removed; sometimes I imagine that I can hear faint traces of the glissando for a generation or two but almost always to fade back into a dierent character of noise. With a population of recognizable, real-world individuals, once the population converges it stays static for several generations before new mutations that enhance tness occur and propagate through the population. Once this re-convergence has occurred, the population tends to remain static for several more generations before another tness-enhancing mutation occurs. 4.1.6 Variables The biggest challenge when using this algorithm to achieve musically interesting results is nding appropriate settings for variables. These variables include the range of numbers of neighboring genes that are grouped together for a single mutation, the probability that a mutation will occur, the range of multipliers

56 for mutation by amplication, the possible powers for mutation by exponentiation, and the range of possible numbers of duplication. On my preliminary run of the algorithm, I tested it on my real-world population with a fairly arbitrary set of default variables. In this case, the output of a population undergoing mutation by duplication sounded quite like a bell; the output of populations undergoing the other types of mutation did not sound at all bell-like and were nearly identical to each other. The population converged to the ospring of the same two individuals regardless of the mutation function and with repeated attempts. With other variables, the output of the algorithm with dierent mutation functions became more varied. It is clear from experimenting with dierent populations that the ideal settings change depending on both the population and the environment. If the user is willing to forgo the ideal, there is a large margin of error and workable settings can be found quite easily. In fact, I was only able to duplicate my original, frustrating results with the original default variables.

4.2

Future Work
In addition to completing the coding tasks (see 3.2, 3.4.2, and 3.4.3)

and implementing the compositional framework (see 3.6) described in chapter III, there are several directions in which I can take this work. In hopes that this process will be a welcome addition to the repertoire of sounds available to composers of electronic music, I would like to develop a user-friendly version, without the compositional framework, that will allow a user to either capture the process of evolution over time or produce a single, evolved sample. As of the time of this writing, it is simply not possible to implement this algorithm in real-time. As processor speed increases, I would like to explore the use of this process for realtime uses such as sound installations.

57

4.3

Closing Remarks
Although the proposed compositional framework has not been fully im-

plemented, the preliminary results are encouraging. The sounds produced by the algorithm, even after converging to a pool of similar individuals, change in interesting and unpredictable, albeit constrained, ways over time. Even after a large number of generations, the output bears the ngerprint of its initial population as well as its environment and the types of mutation the population has undergone. With the introduction of multiple environments and migration, new individuals will enter the environments after convergence, fostering biodiversity. This will provide the resulting pieces with a form dened not only by the changing environments (see 3.6.2) but by periods in which individuals in an environment converge, are joined by new individuals who add their genes to the sound of the sub-population, and re-converge to a new point. Much of the research involving genetic algorithms and music focuses on engineering tasks related to the eld of music, modeling musical production, or on creating tools for practicing musicians (see chapter II). Although a potential application has been proposed (see 4.2), this is a secondary goal. The success of this project is not in its ability to make a population of sounds sound more like their environment, but rather in its ability to create novel sounds that are intimately tied to the process of their creation.

Bibliography
[BE95] John A. Biles and William G. Eign. Genjam populi: Training an iga via audience-mediated performance. Proceedings of the International Computer Music Conference, pages 347348, 1995. Peter Beyls. Evolutionary strategies for spontaneous man-machine interaction. Proceedings of the International Computer Music Conference, pages 171174, 1999. John A. Biles. Genjam: A genetic algorithm for generating jazz solos. Proceedings of the International Computer Music Conference, pages 131137, 1994. John A. Biles. Interactive genjam: Integrating real-time performance with a genetic algorithm. Proceedings of the International Computer Music Conference, pages 232235, 1998. Richard Boulanger, editor. The Csound book: perspectives in software synthesis, sound design, signal processing, and programming. MIT Press, Cambridge, Mass., 2000. Peter Bowcott. High level control of granular synthesis using the concepts of inheritance and social interaction. Proceedings of the International Computer Music Conference, pages 5052, 1990. Stephen Brooks and Brian J. Ross. Automated composition from computer models of biological behavior. Leonardo Music Journal, 6:2731, 1996. A. Burton and T. Vladimirova. Genetic algorithm utilising neural network tness evaluation for musical composition. In ICANNGA 97 Abstracts, 1997. Anthony R. Burton and Tanya Vladimirova. Generation of musical sequences with genetic technique. Computer Music Journal, 23(4):59 73, Winter 1999.

[Bey99]

[Bil94]

[Bil98]

[Bou00]

[Bow90]

[BR96]

[BV97]

[BV99]

58

59 [CYH96] San-kuen Chan, Jennifer Yuen, and Andrew Horner. Discrete summation synthesis and hybrid sampling-wavetable synthesis of acoustic instruments with genetic algorithms. Proceedings of the International Computer Music Conference, pages 4951, 1996. Palle Dahlstedt. Creating and exploring hute parameter spaces: Interactive evolution as a tool for sound composition. Proceedings of the International Computer Music Conference, pages 235242, 2001. Bruno Degazio. The evolution of musical organisms. Leonardo Music Journal, 7:2733, 1997. Palle Dahlstedt and Mats G. Nordahl. Living melodies: Coevolution of sonic communication. Leonardo, 34(3):243248, 2001. Angela Fraser and Ichiro Fujinaga. Toward real-time recognition of acoustic musical instruments. Proceedings of the International Computer Music Conference, pages 175177, 1999. Ichiro Fujinaga. Exemplar-based learning in adaptive optical music recognition system. Proceedings of the International Computer Music Conference, pages 5556, 1996. Ichiro Fujinaga and Jason Vantomme. Genetic algorithms as a method for granular synthesis regulation. Proceedings of the International Computer Music Conference, pages 138141, 1994. Ricardo A. Garcia. Towards the automatic generation of sound synthesis techniques: Preparatory steps. In Audio Engineering Society 109th Convention, Los Angeles, September 22-25 2000. P. M. Gibson and J. A. Byrne. Neurogen: Musical composition using genetic algorithms and cooperating neural networks. In Proceedings of the Second International Conference on Articial Neural Networks, pages 309313, London, 1991. IEE. Andrew Horner and Lydia Ayers. Harmonization of musical progressions with genetic algorithms. Proceedings of the International Computer Music Conference, pages 458484, 1995. Andrew Horner and Lydia Ayers. Common tone adaptive tuning using genetic algorithms. Journal of the Acoustic Society of America, 100(1):630640, July 1996. Andrew Horner and James Beauchamp. Piecewise-linear approximatin of additive synthesis envelopes: A comparison of varous methods. Computer Music Journal, 20(2):7295, Summer 1996.

[Dah01]

[Deg97] [DN01] [FF99]

[Fuj96]

[FV94]

[Gar00]

[GB91]

[HA95]

[HA96]

[HB96]

60 [HBH92] Andrew Horner, James Beauchamp, and Lippold Haken. Wavetable and fm matching synthesis of musical instrument tones. Proceedings of the International Computer Music Conference, pages 1821, 1992. Andrew Horner, James Beauchamp, and Lippold Haken. Machine tongues xvi: Genetic algorithms and their application to fm matching synthesis. Computer Music Journal, 17(4):1729, Winter 1993. Andrew Horner, James Beachamp, and Norman Packard. Timbre breeding. Proceedings of the International Computer Music Conference, pages 396398, 1993. Andrew Horner and Ngai-Man Cheung. Genetic algorithm optimization of additive synthesis envelope breakpoints and group synthesis parameters. Proceedings of the International Computer Music Conference, pages 215221, 1995. Andrew Horner and David E. Goldberg. Genetic algorithms and computer-assisted composition. Proceedings of the International Computer Music Conference, pages 479482, 1991. John H. Holland. Adaptation in natural and articial systems : an introductory analysis with applications to biology, control, and articial intelligence. MIT Press, Cambridge, Mass., 1992. Damon Horowitz. Generating rhythms with genetic algorithms. Proceedings of the International Computer Music Conference, pages 142 143, 1994. Andrew Horner. Envelope matching with genetic algorithms. Journal of New Music Research, 24:318341, 1995. Andrew Horner. Wavetable matching synthesis of dynamic instruments with genetic algorithms. Journal of the Audio Engineering Society, 43(11):916931, 1995. Andrew Horner. Double-modulator fm matching of instrument tones. Computer Music Journal, 20(2):5771, Summer 1996. Dominik Hrnel and Thomas Ragg. Learning musical structure and o style by recognition, prediction and evolution. Proceedings of the International Computer Music Conference, pages 5962, 1996. Bruce L. Jacob. Composition with genetic algorithms. Proceedings of the International Computer Music Conference, pages 452455, 1995. Trader Joes. Joes Ultra Roast Bay Blend. Monrovia, California. Whole Bean Coee. 100% Arabica Beans. Net Wt. 12 oz. (340g).

[HBH93]

[HBP93]

[HC95]

[HG91]

[Hol92]

[Hor94]

[Hor95a] [Hor95b]

[Hor96] [HR96]

[Jac95] [Joe]

61 [Joh99] C. G. Johnson. Exploring the sound-space of synthesis algorithms using interactive genetic algorithms. In G. A. Wiggins, editor, Proceedings of the AISB Workshop on Articial Intelligence and Musical Creativity, Edinburgh, 1999. Brad Johanson and Riccardo Poli. GP-music: An interactive genetic programming system for music generation with automated tness raters. In John R. Koza, Wolfgang Banzhaf, Kumar Chellapilla, Kalyanmoy Deb, Marco Dorigo, David B. Fogel, Max H. Garzon, David E. Goldberg, Hitoshi Iba, and Rick Riolo, editors, Genetic Programming 1998: Proceedings of the Third Annual Conference, pages 181186, University of Wisconsin, Madison, Wisconsin, USA, 22-25 1998. Morgan Kaufmann. J.R. Koza. Genetic Programming; On the Programming of Computers by Means of Natural Selection. The MIT Press, 1992. Pauli Laine and Mika Kuuskankare. Genetic algorithms in musical style oriented generation. International Conference on Evolutionary Computation, pages 858862, 1994. Ryan A. McIntyre. Bach in a box: The evolution of four part baroque harmony using the genetic algorithm. International Conference on Evolutionary Computation, pages 852857, 1994.

[JP98]

[Koz92] [LK94]

[McI94]

[MMZG99] Jonatas Manzolli, Artemis Moroni, Fernando Von Zuben, and Ricardo Gudwin. An evolutionary approach to algorithmic composition. Organised Sound, 4(2):121125, 1999. [MMZG00] Artemis Moroni, Jnatas Manzolli, Fernando Von Zuben, and Rio cardo Gudwin. Vox populi: An interactive evolutionary system for algorithmic music composition. Leonardo Music Journal, 10:4954, 2000. [MT95] Georey F. Miller and Peter M. Todd. The role of mate choice in biocomputation: Sexual selection as a process of search optimization and diversication. In Wolfgang Banzhaf and Frank H. Eeckman, editors, Evolution and Biocomputation: Computational Models of Evolution, New York, 1995. Springer-Verlag. John Polito, Jason M. Daida, and Tommaso F. Bersano-Begey. Musica ex machina: Composing 16th-century counterpoint with genetic programming and symbiosis. In Peter J. Angeline, Robert G. Reynolds, John R. McDonnell, and Russ Eberhart, editors, Evolutionary Programming VI: Proceedings of the Sixth Annual Conference on Evolutionary Programming, Indianapolis, Indiana, USA, 1997. Springer-Verlag.

[PDBB97]

62 [Ral95] David Ralley. Genetic algorithms as a tool for melodic development. Proceedings of the International Computer Music Conference, pages 501502, 1995. Lee Spector and Adam Alpern. Criticism, culture, and the automatic generation of artworks. In Proceedings of the Twelfth National Conference on Articial Intelligence, volume 1, pages 38, 1994. Tapio Takala, James Hahn, Larry Gritz, Joe Geigel, and Jong Won Lee. Using physically-based models and genetic algorithms for functional composition of sound signals, synchronized to animated motion. Proceedings of the International Computer Music Conference, pages 180183, 1993. Kurt Thywissen. Genotator: An environment for investigating the application of genetic algorithms in computer assisted composition. Proceedings of the International Computer Music Conference, pages 274277, 1996. Kurt Thywissen. Evolutionary based algorithmic composition: A demonstration of recent developments in genotator. Proceedings of the International Computer Music Conference, pages 368371, 1997. Kurt Thywissen. Genotator: an environment for exploring the application of evolutionary techniques in computer-assisted composition. Organised Sound, 4(2):127133, 1999. Peter M. Todd and Gregory M. Werner. Frankensteinian methods for evolutionary music composition. In N Grith and P. Todd, editors, Musical Networks: Parallel Distributed Perception and Performance, pages 313339. MIT Press, 1999. Jarkko Vuori and Vesa Vlimki. Parameter estimatin of non-linear a a physical models by simulated evolutionapplication to the ute model. Proceedings of the International Computer Music Conference, pages 402404, 1993. Rodney Waschka. Avoiding the tness bottleneck: Using genetic algorithms to compose orchestral music. Proceedings of the International Computer Music Conference, pages 201203, 1999.

[SA94]

[THG+ 93]

[Thy96]

[Thy97]

[Thy99]

[TW99]

[VV93]

[Was99]

[WPPAT98] G. Wiggins, G. Papadopoulos, S. Phon-Amnuaisuk, and A. Tuson. Evolutionary methods for musical composition. In Proceedings of the CASYS98 Workshop on Anticipation, Music and Cognition, 1998.

Das könnte Ihnen auch gefallen