In: News
1 Dec 2009I’ve updated my NatureToolkit Quark with two new classes. GAWorkbench and GAPmatch. As usual, full documentation is provided with examples so be sure to check them out.
This is a general purpose and modular genetic algorithm class for SuperCollider. Genetic algorithm is a search technique used for finding approximate solutions to search and optimization problems. They use techniques derived from evolutionary biology like inheritance, mutation, (artificial) selection and crossover.
GAWorkbench is a general purpose class that provides an easy interface to interact with your data to be used with GA’s. It can be used for solving general most probably music related computational search problems and can also be used for exploring sound spaces, finding suitable parameters for synthesis networks etc.
GAPmatch is a fast parameter estimation system that intends to work at near-interactive speeds to aid sound design and maybe live performances. To achieve this, it uses a fast search technique called “Genetic Algorithm” which mimics the evolutionary continuum that we observe in nature. It wraps a GAWorkbench instance (described above) for this specific purpose.
In terms of its functionality in the SC environment, parameter estimation means this: You have a SynthDef that is known to be capable of synthesizing a particular type of sound, but finding the right parameters is a time consuming and in some situations a tedious task. Or you have built a raw SynthDef for a synthesis algorithm which exposes a few dozens of parameters and it’s impossible to conduct them at that state. Or you are trying to tune a physical modelling instrument… Situations can vary. This parameter estimation system basically takes an input sound, an input SynthDef and its parameter ranges, and it tries to find the parameters for this particular synthesizer so that the output of the synth is faithful to the attributes of your input sound. From that stage on, you can alter the parameters by yourself to change the synthesized sound in various ways.
Execution of genetic algorithms demands heavy computing resources, and this class can parallelize the task (the fitness calculation stage) across multiple scservers on your local machine (to utilize multiple CPU cores on your machine) and networked machines.
An article I’ve submitted for peer review that describes the inner workings of the system in depth will be provided when I have the permission to do so. Until then, the documentation and sources should provide necessary info.
(You need to have BatUGens and BatPVUgens installed from sc3-plugins for this to work)
I’ve also gone ahead and recorded a little screencast to introduce GAWorkbench and show GAPmatch it in action:
Let me know what you think of it.
Hello there, I'm Batuhan Bozkurt, a sound artist, computer programmer and performer from Istanbul - Turkey. This is my personal hub site where I regularly try to blog and share my projects and interesting things I stumble upon. For more info about me please click here.
12 Responses to NatureToolkit Update: Genetic Algorithms and Parameter Estimation for SuperCollider
CpILL
December 1st, 2009 at 12:25 pm
MAN! Thats friggn awesome! I did some work at Uni on Self Organising Maps (SOM) which I’m thinking of taking up again and you have inspired me to get a move on with it!
Nice work! I think I’ll have a play with it on the weekend to try and model some natural Australian bush sounds I recorded awhile back. Let you know how that goes.
Captain Mikee
December 2nd, 2009 at 8:17 pm
I love the demo! I’d like to see the source code for your examples – have you posted them somewhere?
I think the logical next step of laziness would be the “I know it when I hear it” feature where the fitness function is the listener manually rating the quality of different outputs. Would something like that be possible, or practical?
Batuhan
December 2nd, 2009 at 8:26 pm
Hey Mikee,
The source code is included in the documentation. Check out the help files for GAPmatch and GAWorkbench.
And yes, interactive GA’s are certainly possible, I already have an implementation that works well. However there is a down side to this, you can test one sound at a time only, so you are manually driving the evolution with this. This system checks 600 different parameter sets in every 2 seconds in the above video, 30 generations a minute almost, whereas doing the same with IGA would take about an hour and sore ears. I didn’t pursue it further but maybe I’ll clean up and add that class too. Thanks a lot…
Batuhan
December 2nd, 2009 at 8:29 pm
my calculation is slightly off. it doesn’t take about an hour but 15 hours for a human.
But human judges better in many cases.
Captain Mikee
December 3rd, 2009 at 11:41 pm
Cool! I always end up sitting for hours listening and fiddling with parameters anyway….
Uğur Güney
December 6th, 2009 at 12:56 am
# Batuhan, bu harika olmuş!
# Hep, karmaşık sentezleme algoritmaları kullanmak yerine, muhtelif basit algoritmaların karmaşık kontrol mekanizmalarıyla çalıştırılmalarının müzikal ses üretimi açısından daha uygun olduğunu düşünürüm. Sen bunun muhteşem bir örneğin veriyorsun.
# Tebrik ederim. Ben deneyemedim (Windows’ta quark yükleme işine henüz bulaşmadım) ama; Ellerine sağlık!
Jorge Vazquez
December 6th, 2009 at 8:30 pm
Congratulations for your classes!
And very nice video demonstration!
Pretty impressive!
Thank you Batuhan!
CpILL
December 6th, 2009 at 8:34 pm
IS there any chance of getting the examples you use in the video? I’m interested in how you did your fitness function?
Batuhan
December 6th, 2009 at 8:45 pm
Jorge, thank you.
CpILL, as I’ve mentioned above, the example code I’ve used in the video is included in the documentation (GAPmatch help). The fitness function is tricky, it uses an UGen I’ve coded in C for the purpose. It compares the MSE distance between complex spectrums of the source and synthesized sound and the MSE distance becomes the similarity rating therefore the output of the fitness function (lower is better). I’ll let you know when the paper describing the internals is published.
Here is a paper by Ricardo A. Garcia where he grows sound synthesis graphs (instead of parameters to fixed synthesizer graphs), I use the same similarity rating formula, but discard the phase:
http://galileo.cincom.unical.it/Music/workshop/articoli/garcia.pdf
Fitness functions for GA’s to learn Sound « A.Pander’s Musical Journal
December 6th, 2009 at 11:02 pm
[...] EarSlap (aka Batuhan Bozkurt) released a GA lib for SuperCollider recently. I hadn’t thought about AiI techniques in a long time but associating it in the [...]
isjtar
March 10th, 2010 at 1:54 am
Very impressive Batuhan! I might use your libs in some of my future work, will let you know if I do.
Liked your contribution to the sc tweets too btw.
Thanks for sharing all this.
Batuhan
March 10th, 2010 at 2:45 am
isjtar, thanks a lot for letting me know.
Cheers!