(
Server.default = s = Server.internal.boot;
s.waitForBoot({
s.scope;
});
)
// Env is NOT a UGen. It doesn't actually output numbers. But
// it stores data for envelopes (slow moving signals that usually
// shape some aspect of another note, often amplitude).
Env([0, 0.5, 0.5, 0], [0.5, 0.5, 1.0]).plot
// linen(attackTime, sustainTime, releaseTime, level, curve)
// can also be called an ASR envelope of attack/sustain/release
Env.linen(0.5, 0.5, 1, 0.5, 0).plot;
(
var noteObject, note;
noteObject = CtkSynthDef(\oscili_2a, {arg freq, amp, dur;
var osc, osc2, env, envgen;
env = Env.linen(0.5, 1, 1, 0.5, 0);
// EnvGen is the actual UGen for creating the Env.
envgen = EnvGen.kr(env);
osc = SinOsc.ar(440, 0, 1);
Out.ar(0, osc * envgen)
});
note = noteObject.new(1.0, 3.0);
note.freq_(440).amp_(0.5).dur_(3.0);
note.play;
)