15.5.07

CC Week 9 - Recording

This exercise will involve the creation of a large synthesiser assembly containing the following components (1) MIDI Input and playback (2) A sample playback synthDef (3) An effects synthDef (4) A modulator synthDef (5) The synthDefs will be organised in a way so the modulator can manipulate the sample player which has its output routed through an effects synthDef. (6) Blog your patch and an MP3 result.

This week's task took some time to get my head around, and resulted in the collision of my brain with pain. That is to say, despite my efforts, help file extrapolating, and note taking I have been unable to create a patch that works. I incorporated last week's sample playback SynthDef with corrections into this week's excersise. My aim was to input the drum samples into a reverb SynthDef, which can be modulated by another controller SynthDef. I have been able to create each of the components for this week's task, however I have not been able to implement them into a cohesive, working patch. For a brief time I was able to create a reverb effect on the drums without modulation, however for some reason, without me changing any settings, was unable to recreate on reboot.

I can say that I need help with my memory management; I am not sure how to structure a logical kill off procedure for the multiple synthdefs which are created from the reverb SynthDef. Also my Modulator SynthDef is woefully incomplete. I also had difficulty with bussing signals; the process seems logical, however I am unable to produce results. Here is a downloadable copy of my patch as an rtf file, it contains all my formatting etc. Otherwise here it is below with the formatting decimated by archaic html.

Download Patch[8Kb]





//Boot Server--------------------------------------------------------------->
s = Server.local;
s.boot;

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

//Reverb SynthDef-------------------------------------------------------->
(
SynthDef("reverb", {
//args none

var in,
inBusA = 2,
outBusA = 0,
rev;

//Bus input

in = In.ar(
bus: inBusA,
numChannels: 2
);

//Reverb Generator
5.do({
in = AllpassN.ar(
in: in,
maxdelaytime: 0.3,
delaytime: [0.09.rand, 0.08.rand],
decaytime: 1.0
);
});

rev = in;

//Output

Out.ar(
bus: outBusA,
channelsArray: rev
);
}).send(s);
)

//Controller/Modulator SynthDef------------------------------------------>
(
SynthDef("controller", {

arg freq = 5,
amp = 5;

var sig,
outBusC = 5;
//Signal

sig = SinOsc.kr(
freq: freq,
mul: amp
);

//Output

Out.kr(
bus: outBusC,
channelsArray: sig
);
}).send(s)
)
//------------------------------->
// More Stuff entered here?

// Modulator and Envelope Infrastructure------------------------------>
//- Clearly this section needs work!
inC = In.kr(
bus: inBusB

mod = SinOsc.kr(
freq: mFreq;
mul: mAmp
);

car = SinOsc.ar(
freq: cFreq;
mul: cAmp * inC
);
env = Env.new(
levels: [0,1, 0.3, 0.8, 0],
times: [2, 3, 1, 4],
curve: 'linear'
);
)
//Initialise Instance

r = Synth("reverb");
g = Synth("controller");


//My Sample Playback 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: 2,
channelsArray: signal
);
}).send(s);
)
//Loop load several samples-------------------------------------------------->
(
for(0,8, {

arg i;

Buffer.read(
server: s,
path: ~filePath++"drumSamp"++i++".wav",
bufnum: i
);
//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
]);
}
)

// Setup Recording Settings--------------------------------------------------->

// Manual Recording :: Server
~recPath = (PathName.new(Document.current.path)).pathOnly;
s.recSampleFormat = "int16"; // sample format
s.recHeaderFormat = "WAVE"; // header format
s.recChannels = 1; // channels
s.prepareForRecord(~recPath++"test.wav"); // location
)
(
// Start Recording
s.record;
)
(
// Stop Recording
s.stopRecording;
)