// Ex. 3  IF 98/11/16
// Controls

// line generator  Line.ar(start, end, dur, mul, add)
// plot display 0.01 sec. (10 ms).
(
Synth.plot({ Line.ar(0.1, 0.9, 0.005) });
)

(
plot({ Line.ar(0.1, 0.9, 0.008) });
)

(
plot({ Line.ar(-0.5, 0.5, 0.003) });
)

(
{SinOsc.ar(400, 0, Line.ar(0.0, 0.9, 3))}.play
)

// exponential line generator  XLine.ar(start, end, dur, mul, add)
(
plot({ XLine.ar(0.1, 0.9, 0.008) });
)

(
{SinOsc.ar(400, 0, XLine.ar(0.1, 0.9, 3))}.play
)

// sawtooth oscillator LFSaw.ar(freq, mul, add)

(plot({ LFSaw.ar(500, 1, 0) });)

// used as both Oscillator and LFO:
(play({ LFSaw.ar(LFSaw.kr(4, 400, 400), 0.1) });)


// pulse oscillator	LFPulse.ar(freq, width, mul, add)

(plot({ LFPulse.ar(500, 0.3, 1, 0) });)

// used as both Oscillator and LFO:
(play({ LFPulse.ar(LFPulse.kr(3, 0.3, 200, 200), 0.2, 0.1) });)


// impulse oscillator  Impulse.ar(freq, mul, add)

(plot({ Impulse.ar(1000, 0.75, 0) });)

({Impulse.ar(100)}.scope;)

(
{Impulse.ar(MouseX.kr(0.1, 200))}.scope;
)

(play({ Impulse.ar(XLine.kr(800,100,5), 0.5, 0) });)

// exponential decay Decay.ar(in, decayTime, mul, add)

(plot({ Decay.ar(Impulse.ar(1), 0.01) }))

(scope({ Decay.ar(Impulse.ar(1), 0.01) }))  // Watch carfully

// used as an envelope
(
play({ Decay.ar(Impulse.ar(XLine.kr(1,50,20), 0.25), 0.2, WhiteNoise.ar) })
)

// Breakdown of above example
{Impulse.ar(XLine.kr(1,50,20),1)}.scope

(
play({ Decay.ar(Impulse.ar(1), 0.2, WhiteNoise.ar) })
)

(
scope({ Decay.ar(Impulse.ar(1), 0.2, 1) })
)

(
scope({ Decay.ar(Impulse.ar(1), 0.2, WhiteNoise.ar) })
)

(
scope({ Decay.ar(Impulse.ar(1), MouseX.kr(0, 20), WhiteNoise.ar(0.4)) })
)
