Skip to content

Instantly share code, notes, and snippets.

@tado
Last active March 21, 2024 22:02
Show Gist options
  • Save tado/bb91a5abc6a12149784fbef33fb25a8f to your computer and use it in GitHub Desktop.
Save tado/bb91a5abc6a12149784fbef33fb25a8f to your computer and use it in GitHub Desktop.
SuperColider instruments for my live coding performance
(
SynthDef("superdown", {
arg out = 0, sustain=1, gate = 1, amp = 1, freq, pitch1 = 0.3333333, voice = 800, clipAmount = 0.01, pan, decay=0;
var carFreq = freq;
var modFreq = freq * pitch1;
var modEnv = EnvGen.ar(Env.adsr(0.001, 0.2, 0.5, 0.0, peakLevel: voice), timeScale:sustain);
var pitchenv = EnvGen.kr(Env.new(levels: [1, 0], times: [2], curve: [-5]), timeScale:sustain, doneAction:2);
var mod = SinOsc.ar([modFreq, modFreq * 1.01]) * modEnv;
var car = SinOsc.ar((carFreq + mod) * pitchenv);
var env = EnvGen.ar(Env.pairs([[0,0],[0.1,1],[0.2,1-decay],[0.95,1-decay],[1,0]], -3), timeScale:sustain, doneAction:2);
OffsetOut.ar(out, DirtPan.ar(car, ~dirt.numChannels, pan, env));
}).add;
);
(
SynthDef("supersawfbk", {
arg out, rate=1, decay=0, sustain=1, pan, accelerate, freq,
voice=0.5, semitone=12, resonance=0.2, lfo=1, pitch1=1, speed=1,
flow = 200, fhigh = 20000, rq = 0.5, distort = 0.5, wet = 0.5;
var env = EnvGen.ar(Env.pairs([[0,0],[0.05,1],[0.2,1-decay],[0.95,1-decay],[1,0]], -3), timeScale:sustain, doneAction:2);
var basefreq = freq * DirtFreqScale.kr(speed, accelerate, sustain);
var basefreq2 = basefreq * (2**(semitone/12));
var lfof1 = min(basefreq*10*pitch1, 22000);
var lfof2 = min(lfof1 * (lfo + 1), 22000);
var in = MoogFF.ar(
(0.5 * Mix.arFill(3, {|i| SawDPW.ar(basefreq * ((i-1)*voice/50+1), 0)})) + (0.5 * LFTri.ar(basefreq2, voice)),
LFTri.ar(basefreq/64*rate, 0.5).range(lfof1,lfof2),
resonance*4).tanh*2;
var fbNode = FbNode(2, 1.0);
var signal = Mix.fill(10, {fbNode.delay(1.0.rand)});
signal = RLPF.ar(signal * 0.5 + in, LFNoise1.kr(0.2).exprange(flow, fhigh), rq);
signal = AnalogVintageDistortion.ar(signal, distort);
fbNode.write((in * (1.0 - wet)) + (signal * wet));
Out.ar(out, DirtPan.ar(signal, ~dirt.numChannels, pan, env));
}).add
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment