‹ Useless SuperCollider Class no.1Work with Mark: iStreet - Online ›

Work with Mark: Genetics

2006-09-25 15:23:13 research, supercollider

I also spent time at UoW learning about genetic algorithms and genetic programming. Mainly from John H Holland's books and Karl Sims' papers. I found it all very interesting and inspiring and again I got great help and input from Rob Saunders.

One of our ideas was to construct synthesis networks from parts of our agents' genomes i.e. to have the phenomes be actual synths that would synthesise sound in realtime. The first problem to tackle was a really hard one. How to translate the genome - in the form of an array of floats - into a valid SuperCollider synth definition?

Of course, there are millions of ways to do this translation. I came up with the RedGAPhenome class which works with only binary operators, control and audio unit generators. Unfortunately, there can be no effects or modifier units. On the other hand, the class is fairy flexible and it can deal with genomes of any length (>=4). One can customise which operators and generators to use and specify ranges for their arguments. One can also opt for the topology of the synthesis network (more nested or more flat).

There is no randomness involved in the translation, so each gene should produce the exact same SynthDef. Of course, generators involving noise, chaos and such might make the output sound slightly different each time but the synthesis network should be the same.

This class produces a fantastic range of weird synths with odd synthesis techniques, and it is useful just like a synth creation machine on its own. Here are some generated synths... n_noises, n_fmsynths, and corresponding 5sec audio excerpts are attached below.

Then, after the struggle with the phenome translation, the code for the actual genetic algorithms was easy to write. The genome and its fitness are kept in instances of a class called RedGAGenome, and the cross-breeding and mutation are performed by the class RedGA. There are a couple of different breeding methods but I found the multi-point crossover one to give the generally best results. All the above classes and their respective help files and examples are available on the page: /code/sc/#classes. And there are many more automatically generated synths in the attached krazysynths+gui.scd example below.

I also made a couple of fun example applications stemming from this. One is a six-voice sequencer where you can breed synths, patterns and envelopes. It is attached as 'growing soundsBreedPatternEnv.scd' below. (Note that the timing is a bit shaky. I really should rewrite it to run on the TempoClock instead of the AppClock.)

growing_soundsBreedPatternEnv screenshot

Ref articles:

Ref books:

  • John H. Holland - Hidden Order: How Adaptation Builds Complexity
  • Melanie Mitchell - An introduction to Genetic Algorithms
  • Richard Dawkins - The Blind Watchmaker

n_noises

n_fmsynths

Updates:

  • 101128: growing_soundsBreedPatternEnv.scd file updated, also see the post /f0blog/growing-sounds/.
  • 171229: converted some rtf files to scd and made the GUI run on latest SuperCollider (Qt)
Attachments:
krazysynths+gui.scd
growing_soundsBreedPatternEnv.scd
‹ Useless SuperCollider Class no.1Work with Mark: iStreet - Online ›