//making our patch (signal network) SinOsc mySin => ADSR envelope => JCRev reverb => dac; //declaring variables to use with the ADSR object 10::ms => dur attack; 8::ms => dur decay; 0.5 => float sustain; 48::ms => dur release; //using the set method (function) of our //ADSR object (named envelope) envelope.set( attack, decay, sustain, release ); //set the mix level of our JCRev object named reverb reverb.mix(0.1); //set the volume of our sine wave oscillator //using the SinOsc objects .gain method 0.5 => mySin.gain; //define a function called noteplayer that takes //a duration and pitch as arguments fun void noteplayer(dur duration, float pitch) { pitch => mySin.freq; envelope.keyOn(); //use the .keyOn method of ADSR duration => now; //advance time by the duration given envelope.keyOff(); //use the .keyOff method of ADSR release => now; //use realease variable so there is no clip } //create 2 arrays for pitches and durations //and assign values to them [ 2, 4, 5, 7, 9 ] @=> int scale[]; //scale in # of half steps [ 100::ms, 200::ms, .5::second ] @=> dur phatbeats[]; //use an infinite time loop to use our noteplayer() while ( true ) { //get random values from scale[], assign to variable 'freq' scale[ Math.rand2(0,4) ] => float freq; //random values from phatbeats[] noteplayer(phatbeats[Math.rand2(0,2)], //base pitch + octave transposition + scale value Std.mtof( 60.0 + (Std.rand2(0,1)*12 + freq) )); }