//Number 6 //Chuck a day 2009 //by Scott Hewitt //www.ablelemon.co.uk/chuckaday //Today we play with arrays [440,400,300,0,600,590,550,520,420] @=> int tune[]; [200,220,210,180,300,240,0,310,200] @=> int tuneb[]; [210,350,400,260,200,320,310] @=> int tunec[]; Event enew; Event eenew; Event eeenew; //DSP (maybe there is a better way of dong this) Sitar sit => Echo e => dac; Sitar sitb => Echo ee => dac; Sitar sitc => Echo eee => dac; 1000::ms => e.max => ee.max => eee.max; 0.1 => e.mix => ee.mix => eee.mix; //play array function void mel (){ for (0 => int i; i < tune.cap(); i++){ if(tune[i] != 0){ tune[i] => sit.freq; Std.rand2f(0, 1) => sit.pluck; 0.9 => sit.noteOn; 200::ms => now; 0.0 => sit.noteOff; 200::ms => now; enew.signal(); }else{ 400::ms => now; } } } function void accop () { for (0 => int i; i < tuneb.cap(); i++){ if(tuneb[i] != 0){ tuneb[i] => sitb.freq; Std.rand2f(0, 1) => sitb.pluck; 0.9 => sitb.noteOn; 200::ms => now; 0.0 => sitb.noteOff; 200::ms => now; eenew.signal(); }else{ 400::ms => now; } } } function void melb (){ int kk; for (0 => int i; i < tunec.cap(); i++){ Std.rand2(1, (tunec.cap() -1)) => kk; if(tune[kk] != 0){ tunec[kk] => sitc.freq; Std.rand2f(0, 1) => sitc.pluck; 0.9 => sitc.noteOn; 200::ms => now; 0.0 => sitc.noteOff; 200::ms => now; eeenew.signal(); }else{ 400::ms => now; } } } //create echo values function void echoer (){ while (true){ enew => now; Std.rand2(100, 900) * 1::ms => e.delay; } } function void echoerb (){ while (true){ eenew => now; Std.rand2(100, 1000) * 1::ms => ee.delay; } } function void echoerc (){ while (true){ eeenew => now; Std.rand2(100, 700) * 1::ms => eee.delay; } } //spork shreds spork~ echoer(); spork~ echoerb(); spork~ echoerc(); spork~ mel(); spork~ melb(); spork~ accop(); //keep parent alive so children complete 4::second => now;