Sequencing SuperCollider with Ableton Live using IAC and Sound Flower



The pictured, is of SuperCollider being sequenced with Ableton Live. I am using the IAC bus to transmit MIDI from Live to SuperCollider and Sound Flower to get the audio back into Live for mixing and recording. The midi coming from live contains note frequencies, on/off events, and pitch bend. The source code for the SC3 project comes mainly from the MIDIIn tutorial. I also read some back dated posts about using the SC several with alternative output devices. Below is the source code. It works in three stages:
//First initialize the midi and audio devices
(
MIDIClient.init;
//0 is iac bus internal routing from live!
MIDIIn.connect(0, 0);
//set the action:
MIDIIn.control = {arg src, chan, num, val;
val.postln;
};
Server.internal.options.device = "Soundflower (2ch)";
Server.local.options.device = "Soundflower (2ch)";
);
//next define your synth and start the server
(
MIDIIn.connect;
s = Server.local;
s.boot;
s.latency = 0;

SynthDef("sik-goo", { arg freq=400,fromfreq=100, gate=0.0, bwfreq=800;
var x;
x = Formant.ar(
SinOsc.kr(0.02,0,10,freq),
fromfreq,
bwfreq
);
x = EnvGen.kr(Env.adsr,gate,Latch.kr(gate,gate)) * x;
Out.ar(0,x);
}).send(s);
);
//finally link the midi actions to the defined synth parameters
(
x = Synth("sik-goo");
// action;
MIDIIn.noteOn = {arg src,chan,num,vel;
x.set(\freq,num.midicps /4.0);
x.set(\gate, vel / 200);
x.set(\formfreq, vel / 127 *1000 );
};
MIDIIn.noteOff = { arg src,chan,num,vel;
x.set(\gate, 0.0);
};
MIDIIn.bend = { arg src,chan,val;
x.set(\bwfreq,val * 0.048828125 );
};
);

// cleanup
x.free;


What follows is blatant commercialism, thwarted by technical snafu:


2 comments:

Anonymous said...

Hey thanks for posting this. I was using supercolliderAU to make plugins .. which i then sequenced in ableton. But this is probably a little less work over all. cheers!

http://davebot.com/blog/2008/08/sequencing-supercollider-from-ableton.html

Gianmaria Allibrante said...

Hi, thanks for your code,I'd like to know how can i trig the oscillator every time there is a note in mdiin
thanks a lot
Gianmaria