3.5.07

Create a SC patch that contains a synthDef that utilises the following core elements and
related unit generators as demonstrated in class - carrier, modulator, envelope, filter,
delay and panning. This patch will be playable from a MIDI controller and will utilise
memory management principles.

(
//Initialise MIDI------------------------------>
MIDIClient.init;
MIDIIn.connect;
MIDIIn.noteOn = {

arg uid,
chan,
noteNum,
noteVel
;

[noteNum.midicps, (noteVel.midicps / 100)].postln;

Synth("simpleSine", [
\cAmp, 0.5,
\cFreq, noteNum.midicps,
\mFreq,(noteVel.midicps / 100),
\mAmp, 10
])
};
)

//Initialise Synth------------------------------------------------->
(
SynthDef("simpleSine", {

arg cFreq = 1000,
cAmp = 1;

var car,
mod,
out;

//Modulator
mod = SinOsc.ar(
freq: 300,
mul: 0.5
);

//Carrier
car = SinOsc.ar(
freq: cFreq,
mul: mod * cAmp
);

// Output
out = Out.ar(
bus: 0,
channelsArray: car
);
}).send(s);
)