// sync and set timing variable for shred X.T => dur M; M - (now % M) => now; M/2 => dur T; // load drum sound SndBuf buffy => PitShift shift => X.out; //SndBuf buffy => PitShift shift => dac; "220C/pitch/who bassC.wav" => buffy.read; 1 => shift.mix; 0 => buffy.rate; 0 => buffy.gain; //table of rhythms [ [ 0.25, 0.25, 0.166, .166, .167, 0., 0., 0., 0. ], [ 0.25, 0.25, 0.25, .25, .25, 0.25, 0.25, 0.25, 0.0 ], [ 0.25, 0.25, 0.75, .25, .5, 1.25, 0.25, 0.0, .5 ], [ 2.0, 0.25, 0.25, .25, .25, 0.25, 0.25, 0.25, .25 ] ]@=> float patterns[][]; //note velocity [ [ 0.3, 0.2, 0.3, 0.2, 0.167, 0., 0., 0., 0. ], [ 0.0, 0.3, 0.0, .3, .0, 0.2, 0.3, 0.2, 0.0 ], [ 0.3, 0.25, 0.25, .25, .25, .25, 0.25, 0.25, .25 ], [ .3, 0.25, 0.25, .25, .25, 0.25, 0.25, 0.25, .25 ] ]@=> float velocity[][]; 0 => int count; Std.rand2(0,3)=> int state; // go while( true ) { while (count < 8) { // play, set pitch shifter as neccessary if (pitch.C < 4) { Math.pow(1.06, pitch.C)=> shift.shift;} else {Math.pow (.943, pitch.C) => shift.shift;} 0 => buffy.pos; 1 => buffy.rate; velocity[state][count] => buffy.gain; patterns[state][count]* T => now; count++; } 0 => count; //wait }