// using envelope (ADSR) and a play() function... // patch SinOsc s => ADSR e => JCRev r => dac; // set env params e.set( 10::ms, 5::ms, .5, 10::ms ); // close the env e.keyOff(); // ketchup .1 => r.mix; // quarter note 200::ms => dur quarter; // go while( true ) { // play play( 60, .8, quarter ); play( 74, .8, quarter ); play( 67, .8, quarter ); play( 65, .8, quarter ); play( 64, .8, quarter*2 ); // rest quarter => now; play( 76, .8, quarter ); play( 72, .8, quarter ); play( 71, .8, quarter ); } // play fun void play( float pitch, float velocity, dur T ) { // open the env pitch => Std.mtof => s.freq; // start the attack e.keyOn(); // wait T-e.releaseTime() => now; // close the env e.keyOff(); // let it release e.releaseTime() => now; }