sc_learning_diary / phenosynth.scd

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 ( Sample.dir = "/Users/dan/Library/Application Support/Ableton/Library/Samples/"; ~sample = Sample.new("tests/cariboutesque.aif"); s=Server.default; ~globalOuts = Bus.new(\audio, 0, 2); ~control = PSListenSynthController.new(s, ~globalOuts); ~control.playGroup; ~control.server; ~control.outBus; ~ind = PSSynthDefPhenome.newRandom; ~control.playIndividual(~ind); ~ind.mappedArgs ~ind.identityHash; ~ind.chromosome; 10.do({~control.playIndividual(PSSynthDefPhenome.newRandom)}); ~control.all.do({|a,b,c| [a,b,c].postln;}); Bus.new(\audio, 60, 1).scope; ) /* NOTES: TODO: * provide a way to unwarp as well as warp chromosomes * support multi-channel listeners (In.ar is hardcoded to 1 channel atm) * LFOs * support creatures which vocalise only sporadically (saving CPU, or at least saving earspace) * give lifespans using the exponential distribution \lambda \e ^-\lambda \e * TODO: scale birthRate and deathRate so that they fit eventual fitness * reseed population when they all die * better aging calculations * sort out the interactions of all these different tick rates and periods. * Handle "free controls", values that are passed in live by the user. (esp for triggers) * alter chromosome if Specs are changed through UI or any other means, using all that Dependent business * Give the faintest of indications that I do care about tests * allow custom evolvability mappings and starting chromosome. * I've just noticed that MCLD has been facing the same problem and made classes similar in spirit to mine, as regards selecting the phenotypes rather than genotypes, as the NLTK does: http://www.mcld.co.uk/supercollider/ - see also https://github.com/howthebodyworks/MCLD_Genetic * do free/cleanup logic * normalise fitness gain w/respect to energy expenditure (i.e. amplitude) * less arbitrary immigration * consistently use either class or instance methods for selection/mutation operators CREDITS: Thanks to Martin Marier and Crucial Felix for tips that make this go, and James Nichols for the peer pressure to do it. */