Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Yet another molecular music box
name
code content
( // first run synthdef SynthDef(\piano, {|midinote, outBus=0| Out.ar(outBus, MdaPiano.ar(midinote.midicps, decay:0.5)); // from sc3-plugins }).add; ) ( // now the rest ~dur = {|len1=4, len2=3| Plazy({ var dur = len1; inf.do{|n| var overlap = (n % len1 == 0) || (n % len2 == 0); if(n>=len1 && dur==len1 && overlap, { dur=len2; }, { if(n>0 && dur==len2 && overlap, { dur=len1; }); } ); dur.yield; }; }).asStream; }; ~note = { |root=48| Plazy({ var scale = Scale.major.degrees.flat; inf.do{|n| var oct = (n / scale.size).floor; var degree = 12*oct + scale.wrapAt(n) + root; degree.yield; } }).asStream; }; r = Routine({ var durStream = ~dur.value(9, 14.5); var noteStream = ~note.value(48); inf.do { var dur = durStream.next(); var note = noteStream.next(); fork{ inf.do{ Synth(\piano, [\midinote, note]); 4.yield; // loop duration }; }; dur.yield; }; }); r.play(TempoClock(2)); )
code description
An attempt at coding this algorithm: http://www.synthtopia.com/content/2014/12/22/the-molecular-music-box-how-simple-rules-can-lead-to-rich-patterns/ I haven't really checked for errors, but is sounds ok. There are a few other SC versions as well. See for example: http://www.kimri.org/blog/?p=487 and http://sccode.org/1-4Ww
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change