8.5.07

CC Week 8 - Buffers

Create a SC patch that provides eight sample playback. The playback will be controlled from a MIDI keyboard. Consider MIDI playback control information including pitch, amplitude, filtering, modulation, panning and the use of unit generators explored previously.

Here is my Supercollider Patch as a zipped file. The zip also includes the drum samples needed for this patch to function. If the folder is unzipped into /Users/student/Desktop/ the patch "should" function correctly.
Download[1.3Mb]


//Define current file path
~filePath = PathName.new(Document.current.path);

//My SynthDef------------------------>
(
SynthDef("DethSynth", {

arg bufnum = 0;
//pitch = 1.0;

var signal;

signal = PlayBuf.ar(
numChannels: 1,
bufnum: bufnum,
rate: BufRateScale.kr(bufnum)
);
Out.ar(
bus: 0,
channelsArray: signal
);
}).send(s);
)
//Loop load several samples------------------>
(
for(0,8, {

arg i;

Buffer.read(
server: s,
path: ~filePathSamples++"/Users/student/Desktop/Sound2/drumSamp"++i++".wav",
bufnum: i
//I could not get SC to automatically read samples in folder
//so I have specified the address/path above.
);

//Feedback
["bufID",i,"path",~filePathSamples++"drumSamp"++i++".wav"].postln
}
);
)

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

arg uid,
chan,
noteNum,
noteVel
;

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

Synth("DethSynth", [
\bufnum, noteNum%8,
\pitch, 1.0
]);
}
)