Skip to content

Instantly share code, notes, and snippets.

@madskjeldgaard
Created October 18, 2019 10:49
Show Gist options
  • Save madskjeldgaard/4569c13e4101ce7f137da61d0d53159b to your computer and use it in GitHub Desktop.
Save madskjeldgaard/4569c13e4101ce7f137da61d0d53159b to your computer and use it in GitHub Desktop.
An alternative default synth for SuperCollider
/*
The default synth def sound in SC can be tiresome.
You can change it simply by making a new SynthDef called \default which will overwrite the other one.
To make this change permanent, add it to your startup file.
*/
// A simple triangle wave synth in stereo with panning and a simple low pass filter
(
SynthDef.new(\default, {|dur, attack=0.01, release=1.0, t_gate=1, out, freq=442, cutoff=5500, rq=1, pan=0.0, amp=0.5|
var env = EnvGen.kr(Env.perc(attack, release), t_gate, timeScale: dur, doneAction: 2);
var sig = DPW3Tri.ar(freq: freq, mul: env);
sig = RLPF.ar(sig, cutoff.clip(20.0, 20000.0).poll, rq.clip(0.0,1.0));
sig = Pan2.ar(sig, pan);
Out.ar(out, sig * amp);
}).add;
)
// Test (cute gameboy type music):
/*
(
var cutoffenv = { |dur=16|
Pseg(Pseq([40, 15000],inf), Pn(dur, inf), \exp, \inf)
};
p = Pbind(\dur, 0.125, \degree, Pwhite(0,10), \pan, Pwhite(-1.0,1.0), \lag, Pwhite(0,0.01));
Ppar([
p,
Pbindf(p, \octave, 4, \dur, 0.25, \cutoff, cutoffenv.value(16)),
Pbindf(p, \octave, 3, \dur, 0.5, \cutoff, cutoffenv.value(4))
]).play
)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment