Skip to content

Instantly share code, notes, and snippets.

@bwestergard
Created April 20, 2018 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwestergard/31cc26bb9c1731cc690fa460b8a5d2df to your computer and use it in GitHub Desktop.
Save bwestergard/31cc26bb9c1731cc690fa460b8a5d2df to your computer and use it in GitHub Desktop.
Supercollider Krautrock
Server.default.boot;
(
SynthDef(\kick, { | sustain = 1, freq = 440 |
var snd = SinOsc.ar(XLine.ar(freq/2, freq/4, 0.05 * sustain)).dup * XLine.ar(1.1,1e-4,sustain, doneAction: 2);
Out.ar(\out.kr(0), snd * 1.9 * \amp.kr(0.1));
}).add;
)
(
SynthDef(\ping, { | freq = 440, sustain = 0.3, start = 16, end = 0.5 |
var epsilon = 0.01;
var snd = VarSaw.ar(freq * [0.99,1,2,3] * LFNoise2.ar(3!4).exprange(1-epsilon,1+epsilon), width: LFNoise2.ar(1/2).exprange(0.01,0.5)).dup * XLine.ar(1,1e-3,sustain, doneAction:2) * XLine.ar(0.1, 1, sustain * 0.05);
Out.ar(\out.kr(0), RLPF.ar(Splay.ar(snd,1), freq * XLine.ar(start,end, sustain), 0.3) * \amp.kr(0.1));
}).add;
)
(
SynthDef(\pureping, { | freq = 440, sustain = 0.3 |
var snd = SinOsc.ar(freq*2).dup * XLine.ar(1, 1e-4, sustain * 2, doneAction: 2);
Out.ar(\out.kr(0), snd * \amp.kr(0.3));
}).add;
)
(
SynthDef(\hh, { | freq = 440, sustain = 0.3 |
var snd = BPF.ar(WhiteNoise.ar, 7000, 0.4).dup;
Out.ar(\out.kr(0), snd * XLine.ar(4,0.1, sustain, doneAction: 2) * \amp.kr(0.1));
}).add;
)
(
var barmul = 2**6;
Ppar([
Pbind(*[
instrument: \kick,
amp: -18.dbamp,
degree: Pseq(([0,0,0]!7 ++ [0,0,4]).flatten,inf),
legato: Pn(Penv([0.2,1.3,0.2], [1,1] * barmul, 'exp')),
dur: Pseq([1,2,1],inf) / 4
]),
Pbind(*[
instrument: \hh,
amp: (Pseq([0,0,1,0,0,0,1,1], inf) * 8 + Pn(Penv([-70,-35,-70], [3,1] * barmul, 'exp'))).dbamp,
legato: Pn(Penv([1/4,1/8,1/4], [3,1] * 2 * barmul, 'exp')),
dur: 1/4
]),
Pbind(*[
instrument: \pureping,
amp: -18.dbamp,
legato: Pn(Penv([0.1,4,0.1], [32,32] * barmul, 'exp')),
degree: Pseq(([\rest, \rest, 0, \rest]!7 ++ [\rest, \rest, 4, 5]).flatten, inf),
dur: 1 / 4
]),
Pbind(*[
instrument: \ping,
amp: -23.dbamp,
legato: Pn(Penv([1/2,4,1/2], [8,8] * 8 * barmul, 'exp')),
start: Pn(Penv([16,1/2,16], [2,1] * barmul, 'exp')),
end: Pn(Penv([1/2,16,1/2], [1,2] * barmul, 'exp')),
degree: Pseq([[-7,4-7,0,2,4],[1,2,4,6]],inf) - 7,
dur: Pseq([6,2],inf)
]),
Pbind(*[
instrument: \pureping,
amp: Pn(Penv([-25,-40,-25], [1,3] * 2 * barmul, 'exp')).dbamp,
legato: 1/2,
degree: Pseq([\rest,\rest,8], inf) - 7,
dur: 1/4
]),
Pbind(*[
instrument: \pureping,
amp: Pn(Penv([-25,-40,-25], [1,3] * 2 * barmul, 'exp')).dbamp,
legato: 1/2,
degree: Pseq([\rest,6,\rest], inf) - 7,
dur: 1/4
])
]).play(TempoClock(90 / 60));
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment