Introduction to genetic algorithms? And texts on using genetic algorithms for automatic music composition?
April 29, 2004 9:16 PM   Subscribe

I've been playing around with the idea of using a genetic algorithm for automatic music composition, but I can't seem to find a decent introduction/reference on the subject -- the best I've seen is a few relatively high-level academic papers. Could anyone direct me to a good source, or even give a brief overview? Thanks!

Note: I'm looking for something really basic to start with, perhaps with a limited range of notes and low requirements for processing power (think microcontrollers).
posted by Krrrlson to Computers & Internet (9 answers total)
 
I'm curious: what are you going to test fitness against?
posted by Ethereal Bligh at 9:53 PM on April 29, 2004


Krrrlson: I can't give you pointers to resources, but I'll give you some advice, which probably isn't worth too much, but the university where I studied gave me $1000 to think about this for a while, so...

(1) I got really, really excited about using GAs for composition when I first learned about them. After a while, though, I realized that (like any GA) they're only roughly as good as your ability to codify a desireable goal as a fitness function. This can be hard to do with art.

Not impossible at all, probably more feasible with music than with any other art. But if you're gonna succeed, you're going to have to break down the art of composition into some good sub goals where you can give some good rules about what success is.

What are the tasks you want your GAs to accomplish? A series of feel-good melodic intervals? A catchy rhythm? An interesting harmonic progression? One that's roughly valid under the rules of four-part harmony? Or maybe a just getting [this is good] votes from passerby on the internet, after serving a series of random tunes to visitors. Really, you either have to build some mechanism for recording subjective feedback, or you have to construct some sort of semi-deterministic rules (based on statistical analysis of music, or understanding of theory) that gives you a sort of quasi-Markov automata.

(2) Once I got my goals defined, I got lost in a subject I'm coming to regard as a complete quagmire: date format / protocol for evaluation, manipulation, representation of the music you've generated. MIDI? NIFF? ENIGMA? Lime's format? Roll my own? There's a lot of formats out there. I eventually settled on a very simple little scheme which I'd translate into playable audio manually after output, though I wish in retrospect I'd come up with a tool that output MIDI or maybe, if I felt masochistic, CSound scores.

I ended up choosing to try to generate novel but non-jarring harmonizations of a melody. I scored harmonizations by progressions that occured within them, and by checking how well melodic tones fit with a suggested chord in the time interval that chord applied.

Overally, I didn't come up with great results, though there was some interesting stuff (which I'm not sure I couldn't have gotten out of a simpler Markov-Matrix type model). But maybe if I could have tweaked or nuanced my fitness functions.... which brings us back to the reason why researchers love GAs. Because you can spend years tweaking your fitness functions. I don't know if the grant givers have caught on yet.
posted by weston at 10:07 PM on April 29, 2004


Fitness functions are the problem, indeed. I'm an ecologist who's also using evolutionary algorithms, and a key point about selection is that fitness varies with environment. Whereby, in this case, the environment is the listeners, all of whom will have a different opinion of what a "fit" song is. On top of that, it will be a slow process if you use actual human ears to test on. If you want to use evolutionary algorithms to generate something truly novel, your initial genotypes are going to have to be wide and varied, resulting in a very low proportion of tunes that anyone would judge to be listenable. That's going to create a strong selective force, sure, but also a lot of gene fixation and loss of genetic diversity.

I'm not sure if you want any general references on constructing GA's (not necessarily in a musical context), but if anyone out there has some, I'd be interested in seeing them too.

Because you can spend years tweaking your fitness functions. I don't know if the grant givers have caught on yet.

They only give me 3 years to do this PhD...
posted by Jimbob at 11:17 PM on April 29, 2004


I know nothing about this subject. But I use databases frequently, including postgresql. Postgre apparently uses a genetic algorithm to plan some of its more complex queries. Thus, the postgre manual has some references on genetic algorithms. The "further reading" section actually has a subsection about music. All googlable.

Evolution of music:
  • GenJam (Genetic Jammer) is an interactive genetic algorithm by Al Biles that learns to play jazz solos. See also: Neural Network Fitness Functions for a Musical IGA
  • GenBebop by Lee Spector
  • Sonomorphs (An Application of Genetic Algorithms to the Growth and Development of Musical Organisms), and Further Adventures of the Sonomorphs by Gary Lee Nelson
  • GAMusic 1.0 by Jason H. Moore

posted by gsteff at 11:41 PM on April 29, 2004


as everyone else has said, it's the fitness function that matters. to the point where you really shouldn't bother worrying about anything else until you have a good idea of how to measure how good your music is - otherwise there's nothing to "guide" your population from random noise to sweet harmony.

i did something similar for rhythms, rather than music (seemed like a simpler problem). my approach was to use a representation that is constrained to provide relatively regular output and then select for the most random results. the idea being that perhaps there is a ontinuum between regularity and randomness, and i would be able to evolve along that line until i hit upon something useful.

it was fun, but never a huge success.

you might try something similar for meodies, using a system that generates predictable melodies and progressively disturbing it. however, the continuum hypothesis didn't really hold for rhythms - it's much less likely to do so for melody.

one site that used to be quite helpful (years ago!) is generation5.org. no idea how it is now.

some notes of mine here; even less detail about a rewrite in ml (original was lisp code that modified itself) here,
posted by andrew cooke at 4:29 AM on April 30, 2004


rats. currently fixing up some missing pages on the site related to that. if anyone tried that link, please try again in a few mins.
posted by andrew cooke at 4:55 AM on April 30, 2004


10 monkeys in a room with bongos and a xylophone, and you don't need no steenkin' algorithm! but please, there's enough noise in the world.
posted by quonsar at 7:40 AM on April 30, 2004


On the music side, you might be interested in this (long) thread on the Reaktor forum: An Introduction to Algorithmic Composition. Not really the "introduction/reference" you're looking for, but some interesting discussion about music theory, math, and the role of the artist, plus links to further resources.
posted by Dean King at 8:20 AM on April 30, 2004


You might try contacting Peter Langston who has written a slew of applications to do just this. I found this one on his site.
posted by plinth at 10:42 AM on April 30, 2004


« Older What are some really good books on modern art or...   |   Wedding jokes/one-liners Newer »
This thread is closed to new comments.