.cc - week seven.
Today I created a Synthesizer using an Audio File (stored in a Buffer). This is a sample from Nine Inch Nail's new DRM-FREE CD The Slip, taken from the track "Corona Radiata."
//Load File Path/Directory of Audio Fide
(
// File Path
~filePath = (PathName.new(Document.current.path)).pathOnly;
)
(
// Play Sample
SynthDef("CoronaRadiata",{
// Arguments
arg bufnum = 0, pitch, amp;
// Variables
var out = 0, envStruct, envGen, sig, postSig, panLine, panMod, panSig, postPan;
// Envelope Structure
envStruct = Env(
levels: [0.0, 0.7, 0.6, 0.0],
times: [0.5, 6.0, 1.0],
curve: 'sine'
).plot;
// Envelope Instance
envGen = EnvGen.kr(
envelope: envStruct,
gate: 1.0,
doneAction: 2.0
);
// Playback
sig = PlayBuf.ar(
numChannels: 1,
bufnum: bufnum,
rate: BufRateScale.kr(bufnum) * pitch
);
postSig = (sig * amp) * envGen;
// Panner
panLine = Line.kr(
start: 0,
end: 1.0,
dur: 1.0,
doneAction: 0
);
panMod = SinOsc.kr(
freq: 2
);
panSig = Pan2.ar(
in: postSig,
pos: panMod * panLine,
level: 0.3
);
postPan = panSig;
// Output
Out.ar(
bus: out,
channelsArray: sig.dup
);
}).send(s);
)
(
// Load Sound File
b = Buffer.read(s, ~filePath++"CoronaRadiata.aif")
)
(
// Play the Buffer (Check that Sound File is found)
. c = Synth("CoronaRadiata", [\bufnum, b.bufnum, \pitch, 1.0, \amp, 0.75]);
)
//MIDI control
(
// Activate - Note On
MIDIIn.noteOn = {
// Arguments
arg src, chan, num, vel;
// Carrier Frequency
Synth("CoronaRadiata", [\bufnum, b.bufnum, \pitch, (num/127.0), \amp, (vel/127.0)]);
};
MIDIIn.noteOff = {};
)
The .zip file below contains the "CoronaRadiata.aif" file needed to run the synthesizer. It also contains more legible formatting for the code.
synth_def(2).zip (1.6 mB)
synth_def(2).zip also contains a 'IndustrialAmbience' synth, which I made using code borrowed from John Delany.
.sources.
Haines, Christian 01.05.08, "Synthesiser Definitions (2)," Lecture of EMU, Adelaide University.
iieiwrmeieweeiimeemmwreiweremweireeemeimwieewwrwweereireeiimeewmiwwwemwiewimeeeremeiewmemweewieewerwemwiimiewmeiwireiiwrrewmwewree |
6.5.08
synthesizer creation in SuperCollider (2)
copywrite 1:36 pm
Subscribe to:
Post Comments (Atom)
1 comment:
I like the CoronaRadiata sample... reminds me of the Russian electro-acoustic composer Artemiy Artemiev, for its dry ambient tone.
By the way, you inadvertently helped me out with last week's SC patch, as I was trying to apply an envelope to it in a similar manner to what you did - cheers!
Post a Comment