//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; 1000::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 } //use our noteplayer() function to make a melody noteplayer(800::ms, 220); noteplayer(2000::ms, 440); noteplayer(100::ms, 666); noteplayer(500::ms, 333);