s = Server.internal.boot; // send multiple messaages to the Server object!

// Consecutive messages work on whatever the message to

// the right returns. In this case, Server.internal 

// returns a Server object, then you tell it to 'boot'

Server.default = s;

s.scope;


(

var noteObject, note;

// add dur to the example... 

noteObject = CtkSynthDef(\oscili,  {arg freq, amp, envDur;

var osc, env;

osc = SinOsc.ar(freq, 0, amp);

env = Line.kr(1, 0, envDur);

// you can continue to assign values to a variable, 

// even overwriting it with itself

env = env * env; // creates a steeper envelope

Out.ar(0, osc * env)

});


// create a new instance of the note above that will start 1 second after

// being played and last for 2 seconds

note = noteObject.new(1.0, 2.0);

note.freq_(440).amp_(0.25).envDur_(2);

note.play;


);