// our UGen patch ModalBar bar => JCRev r => dac; // set reverb params .15 => r.mix; // infinite time loop while( true ) { // play a note playNote( Std.rand2(24,36)*2, Std.rand2f(.5,.8), 800::ms ); } // function encapsulating note playing fun void playNote( float pitch, float velocity, dur duration ) { // choose pitch pitch => Std.mtof => bar.freq; // sound the note, passing in velocity velocity => bar.noteOn; // advance time duration => now; }