Using SuperCollider as an Oscillator and Gate Sequencer with a Modular Synth
Tonight I had the goal of interfacing SuperCollider with the modular synth a bit more. I still don’t have a proper oscillator module in my eurorack synth, so I have been looking for ways to send sound externally into the modular from the computer, gameboys, etc. I have also been wanting to experiment with shaping sequenced sounds coming from SuperCollider using the modular.
The concept is that SuperCollider generates a constant stream of audio (like an oscillator module), and can be sequenced using the built-in Pattern library. Every time a note changes, SC sends out a gate trigger signal through one of the audio outputs which is then used to trigger an envelope controlling a VCA.
So here is a solution I came up with today. In order to do this you need SuperCollider, a DC-coupled audio interface (MOTU or others), a floating-ring cable, and a modular synth.
The signal flow is as follows:
MOTU OUT 3 (SC audio) –> Filter –> VCA –> Delay –> Speaker
MOTU OUT 8 (SC gate using floating ring cable) –> envelope Trigger In –> VCA CV In
LFO Module Signal –> Filter Cutoff CV In
SynthDef(\oscwithGate, {
|freq=440, t_envgate=0, dur=1, amp=0.8, audioOut=0, gateOut=7|
var osc, gater;
osc = LFSaw.ar(freq, mul: amp);
gater = Trig1.kr(t_envgate, 0.1).range(0, 5);
Out.ar(audioOut, osc);
Out.ar(gateOut, K2A.ar(gater));
}).add;
Pdef(\osc,
Pmono(
\oscwithGate,
\octave, Prand([2, 3, 4, 5], inf),
\root, 0,
\degree, Prand([0, 1, 2, 3, 4, 5, 6, 7], inf),
\dur, Pseq([Pn(0.25, 8), Pn(1/3, 6), Pn(1/5, 5)], inf),
\envgate, 1,
\audioOut, 2,
\gateOut, 7,
));
Pdef(\osc).play;
Pdef(\osc).stop;This code creates the simple oscillator modules and takes care of the gating at the same time. Every time a new note is chosen in the Pmono, the \envgate command sends a “1” which triggers the Trig1.kr UGen which is sent to the audio output specified by the gateOut argument. I had to increase the range of the Trig1.kr UGen to 5 otherwise I didn’t get a hot enough signal to actually trigger the Trig input on the Maths module.
Questions or Comments Welcome.