Melody Generation with Evolutionary Computation
description
Transcript of Melody Generation with Evolutionary Computation
![Page 1: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/1.jpg)
Melody Generation with Evolutionary Computation
By Matt Johnson
November 14, 2003
![Page 2: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/2.jpg)
Main Topics
• Goal of Research
• Why use an EA?
• Problem Solving Approach
• Representation
• Fitness, Mutation, Reproduction
• The Next Step
![Page 3: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/3.jpg)
Goal of Research
• Write a computer program that will generate a beautiful melody.
• Melody should be a traditional soprano part in the style of church hymnody.
• This melody will then be processed by CAVM so it may be heard in a harmonic context.
![Page 4: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/4.jpg)
Why use an EA?
• EAs can handle complex problems.• Complexity of this problem:
– An average soprano can sing notes in the range from D1 to G2, or 18 different pitches. (see pic on next slide)
– There are 8 note durations typically found in this style of music: sixteenth, eighth, quarter, half, whole, dotted eighth, dotted quarter, dotted half.
![Page 5: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/5.jpg)
Vocal ranges
![Page 6: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/6.jpg)
Why use an EA? (cont)
• The number of notes found in a typical hymn can range from roughly 20 to 60. Let’s use 40 for our calculation.
• Pitches * Durations = 18 * 8 = 144 = Number of possible notes. (omitting rests)
• Think of a melody as a string of notes.• Number of potential melodies: 144^40 = 2
* 10^86 melodies to chose from.
![Page 7: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/7.jpg)
Problem Solving Thoughts
• Reduce the search space by constraining the melody to notes within a key.
• Will use as much domain knowledge as possible.
• Will initialize randomly so that no known melodies are produced. – Uniqueness is required.
![Page 8: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/8.jpg)
Problem Solving Approach
• Find an appropriate representation.
• Make observations about melodies and come up with a fitness function.
• Will use a basic evolutionary type algorithm and tweak it as needed.
![Page 9: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/9.jpg)
Representation
• The building block of music is the note.
• A note is made up of a pitch and a duration.
• A melody is a string of notes.
• An individual in the population will be one melody.
![Page 10: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/10.jpg)
About Notes...
• Scale Degree • Name• Note Length• Octave
![Page 11: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/11.jpg)
Representation (cont)
• A melody is a string of notes.
• Every individual represents one melody.
![Page 12: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/12.jpg)
Melody Observations
• Melodies tend to move by step.
• Jumps of an interval larger than one fifth are uncommon.
• Melodies frequently contain repeating patterns.
![Page 13: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/13.jpg)
Note Movement
![Page 14: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/14.jpg)
Melody Example
![Page 15: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/15.jpg)
Fitness
• Reward one step changes (interval of a second)
• Reward jumps of a third, but not quite as much as stepwise changes.
• Reward jumps of a fourth and a fifth, but not quite as much as a third.
![Page 16: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/16.jpg)
Fitness (cont)
• Penalize for jumps larger than a fifth.
• Penalize harshly for jumps larger than one octave.
• Penalize for melodies with a high percentage of sixteenth notes – they are hard to sing.
![Page 17: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/17.jpg)
Fitness - advanced
• Search for and reward naturally occurring repetition of four or more notes.
• Search for and reward ascending and / or descending runs.
![Page 18: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/18.jpg)
Reproduction
• Melodies will be ranked based on their fitness.
• A number of parents will be selected using rank based selection.
• Interesting phrases from each melody will be selected and combined to form a new melody.
![Page 19: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/19.jpg)
Genetic Operators
• Play Two – concatenate two different melodies [2]
• Add Space – insert a rest into a melody [2]
• Play Twice – concatenate a melody onto itself [2]
• Shift Up – Shift every note in the string up to the next highest note [2]
![Page 20: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/20.jpg)
Genetic Operators (cont)
• Phrase Start – mutate the beginning of each phrase so that it starts with the tonic note on a down beat [1]
• Perturb – mutate one note by moving it up or down one step [1]
![Page 21: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/21.jpg)
Competition
• Will periodically remove the worst individuals from the population.
![Page 22: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/22.jpg)
The Next Step
• Run the generated melody through CAVM.
• Evolve four parts at once.
![Page 23: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/23.jpg)
Questions?
![Page 24: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/24.jpg)
Related Work
• Peter Todd Gregory – “Frankensteinian Methods for Evolutionary Music Composition”
• Co-evolve hopeful singers and music critics• The female individual represents the
evolving environment and chooses the males.
• Males represent the singers.
![Page 25: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/25.jpg)
Related Work (cont)
• The female maintains a note transition table.
• Table is used to select the males – the table itself evolves.
• The males evolve their songs in order to be selected.
![Page 26: Melody Generation with Evolutionary Computation](https://reader036.fdocuments.us/reader036/viewer/2022062409/56814ab6550346895db7c947/html5/thumbnails/26.jpg)
References
1. G. Wiggins and G. Papadopoulos and S. Phon-Amnuaisuk and A. Tuson. "Evolutionary methods for musical composition“
2. Brad Johanson and Riccardo Poli. "GP-Music: An Interactive Genetic Programming System for Music Generation with Automated Fitness Raters"