2 // (also see ../midi/polyfony.ck for more polyfony)
4 // the size of the array should be the max number of wurlies
5 // you want to play simultaneously, at any point.
7 // variable to remember the last one played
13 // connect the wurlies
14 for( int i; i < wurlies.cap(); i++ )
18 [ 61, 63, 65, 66, 68 ] @=> int notes[];
23 for( int i; i < notes.cap(); i++ )
25 play( notes[i], Std.rand2f( .3, .9 ) );
30 // basic play function (add more arguments as needed)
31 fun void play( float note, float velocity )
33 // first figure which to play
34 // round robin may work
35 ( which + 1 ) % wurlies.cap() => which;
38 Std.mtof( note ) => wurlies[which].freq;
39 velocity => wurlies[which].noteOn;