X.T => dur M; M - (now % M) => now; M * 4 => dur T; ["220C/pitch/bass/bass1.ck", "220C/pitch/bass/bass2.ck", "220C/pitch/bass/bass3.ck", "220C/pitch/bass/bass_samp1.ck", "220C/pitch/bass/bass_samp2.ck", "220C/pitch/bass/bass_samp3.ck", "220C/pitch/bass/bass_moog.ck"] @=> string arr[]; 0 => int A; 0 => int low; 6 => int hi; //phase affects markov table for removing or replacing bass. //if in state[1] [[.0+.1*X.phase, .9-.1*X.phase, .1], [.5-.05*X.phase, 0.5+.05*X.phase, .1], [.0, .1, .0]] @=> float table[][]; 0 => int state; while (true) { //state 0- remove bass if there if (state == 0) { if (pitch.bass == 1) {4*M=>now; Machine.remove ( A ); 0 => pitch.bass;} else {4*M=>now;} } //state 1- add bass if not there if (state == 1) { if (pitch.bass == 0) { Machine.add ( arr[Std.rand2(low,hi)] ) => A; 1 => pitch.bass; 4*M=>now; } else {4*M=>now;} } //state 2 - replace bass with other bass, if there. Else add if (state == 2) { if (pitch.bass == 1) {4*M=>now; Machine.remove ( A ); Machine.add ( arr[Std.rand2(low,hi)] ) => A; } else {Machine.add ( arr[Std.rand2(low,hi)] ) => A; 1 => pitch.bass; 4*M=>now; } } //run probability to find whether to add, remove, or change bass Std.rand2f( 0, 1 ) => float prob; 0 => float sum; for( int i; i < table[state].size(); i++ ) { table[state][i] +=> sum; if( sum > prob ) { i => state; break; } } //wait }