.cc - week six.
This week I have created a synthesiser using SuperCollider. I found some code on a forum which helped me make it into a poly synth, but I now have lost the link to this site >.>;
Anyway, here's the code:
synth_def(1).rtf
// Get List of Sources
MIDIClient.sources;
(
// Initialise
MIDIClient.init;
// Connect to Source (0 in this case)
MIDIIn.connectByUID(inport: 0, uid: MIDIClient.sources.at(0).uid);
)
(
var poly;
poly = Array.newClear(128); //array to hold the synth instances
SynthDef("SoundWallKeys", {
arg freq = 440,
rate = 0.4,
gate = 0.0;
// Variables -- declaring
var partials = 20, //number of partials
waveshape,
env,
out;
waveshape =
Mix.fill(
partials, { //each partial's function
SinOsc.ar(
freq: (freq + (freq * 800.0.rand)), //Y axis control pitch
phase: 0,
mul: 0.3 / partials //volume
)
});
//create an envelope
env = EnvGen.kr(Env.adsr(0.001, 0.005, 0.8, 0.5), gate, Latch.kr(gate, gate), doneAction:2);
// Output
out = Out.ar( bus: 0, channelsArray: waveshape * env); //add envelope to waveform
}).send(s);
(
MIDIIn.noteOn = { // note on info to send to synth
arg src, chan, num, vel;
a = Synth("SoundWallKeys"); // a = electroBass
poly.put(num, a); //put note into poly array
[num, vel].postln; //print MIDI-In note and vel
a.set(\freq, num.midicps); //change frequency of 'a'
a.set(\gate, vel/127); //
};
MIDIIn.noteOff = { // note on info to send to synth
arg src, chan, num, vel;
poly[num].set(\gate, 0.0)
};
)
)
synthexample.mp3 (848 kB)
.sources.
Haines, Christian 10.04.08, "Synthesiser Definitions (1)," Lecture of EMU, Adelaide University.
iieiwrmeieweeiimeemmwreiweremweireeemeimwieewwrwweereireeiimeewmiwwwemwiewimeeeremeiewmemweewieewerwemwiimiewmeiwireiiwrrewmwewree |
16.4.08
synthesiser creation in SuperCollider
copywrite 4:45 pm
Subscribe to:
Post Comments (Atom)
2 comments:
Hey, I just ran your patch - nice synth stabs.
you moved out yet?
What are you doing Friday during the day?
Post a Comment