260 likes | 328 Views
Explore the goal, methodology, and genetic operators used in generating traditional soprano melodies through evolutionary computation, optimizing for beauty and harmonic context.
E N D
Melody Generation with Evolutionary Computation By Matt Johnson November 14, 2003
Main Topics • Goal of Research • Why use an EA? • Problem Solving Approach • Representation • Fitness, Mutation, Reproduction • The Next Step
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.
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.
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.
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.
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.
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.
About Notes... • Scale Degree • Name • Note Length • Octave
Representation (cont) • A melody is a string of notes. • Every individual represents one melody.
Melody Observations • Melodies tend to move by step. • Jumps of an interval larger than one fifth are uncommon. • Melodies frequently contain repeating patterns.
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.
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.
Fitness - advanced • Search for and reward naturally occurring repetition of four or more notes. • Search for and reward ascending and / or descending runs.
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.
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]
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]
Competition • Will periodically remove the worst individuals from the population.
The Next Step • Run the generated melody through CAVM. • Evolve four parts at once.
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.
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.
References • G. Wiggins and G. Papadopoulos and S. Phon-Amnuaisuk and A. Tuson. "Evolutionary methods for musical composition“ • Brad Johanson and Riccardo Poli. "GP-Music: An Interactive Genetic Programming System for Music Generation with Automated Fitness Raters"