Skip to content

Instantly share code, notes, and snippets.

@tedthetrumpet
Created June 19, 2016 19:18
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 tedthetrumpet/87785591549962a80bf0cc777ff543db to your computer and use it in GitHub Desktop.
Save tedthetrumpet/87785591549962a80bf0cc777ff543db to your computer and use it in GitHub Desktop.
Livecoding experiment, sounds a bit dub.
(
Pdef.all.clear;
Ndef.all.clear;
s.waitForBoot{
// setup sample paths and \bf synth
~hitzpath="/Users/jsimon/Music/SuperCollider Recordings/hitzamples/"; // some hits
~bufs = (~hitzpath ++ "*.aiff").pathMatch.collect({ |i| Buffer.read(s, i)});
SynthDef(\bf, {|out=0 buf=0 amp=0.1 freq=261.6255653006|
var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * freq/60.midicps, doneAction:2);
Out.ar(out, sig * amp)
}).add;
// mixer node for fx
~mbus = Bus.audio(s, 2);
Ndef(\m).put(0, { InFeedback.ar(~mbus, 2) }).fadeTime_(0.2).play;
// tempo clock
t = TempoClock(140/60).permanent_(true);
s.sync;
SynthDef(\formant, { |out= 0, freq = 261.6255653006, formfreq = 463, bwfreq = 200, gate = 1, amp = 0.1|
// var env = EnvGen.kr(Env.adsr(), gate, doneAction:2);
var env = EnvGen.kr(Env.adsr(releaseTime:0.5, decayTime:0.1), gate, doneAction:2);
var sig = Formant.ar(freq * ((-1..1)/500 + 1), formfreq * env.range(0.01,2), bwfreq); // 3 chans, detuned
sig = sig * env;
Out.ar(out, Splay.ar(sig) * amp)
}).add;
};
)
t.sync(110/60)
// stuff to jam with
Pbindef(\x, \instrument, \bf, \out, ~mbus)
Pbindef(\x, \dur, 1/4)
~g1={~bufs.choose}!8
~g2={~bufs.choose}!8
Pbindef(\x, \buf, Pseq([Pn(~g1,3), ~g2].flatten, inf))
Pdefn(\a1, Pseq(({[[1,0,0.2],[1,0]].choose}!4).flatten[0..15]/8, inf))
Pdefn(\a2, Pseq(({[[1,0,0.2],[0,0]].choose}!4).flatten[0..15]/8, inf))
Pbindef(\x, \amp, Pseq([Pn(Pdefn(\a1),3), Pdefn(\a2)], inf) * 1.4)
Pbindef(\x).play(t, quant: 4)
Pbindef(\x).stop
Pbindef(\x).play(t)
Ndef(\m).put(1, nil)
Ndef(\m).put(2, \filter -> { |i| LPF.ar(i,5000)})
Ndef(\m).put(1, \filter -> { |i| CombN.ar(i, 5, t.tempo/4)}).set(\wet1, 0.2)
Pbindef(\y, \instrument, \formant)
Pbindef(\y, \formfreq, Pfunc({50 + 100.rand}))
Pbindef(\y, \amp, 0.05)
Pbindef(\y, \dur, 1/2)
Pbindef(\y, \legato, 0.2)
Pdefn(\riff2, Pseq(((-7!16) ++ (-2!8) ++ (-1!8)).flatten -24))
Pdefn(\riff1, Pseq(((-5!16) ++ (0!16)).flatten -24))
Pbindef(\y, \note, Pseq([Pn(Pdefn(\riff1),3), Pn(Pdefn(\riff2),1)],inf))
Pbindef(\y).play(t, quant:4)
Pbindef(\y).stop
Pdefn(\a4, Pseq(({[[1,0,0.2],[0,0]].choose}!4).flatten[0..15]/8, inf))
Pdefn(\a3, Pseq(({[[1,0,0.2],[1,0]].choose}!4).flatten[0..15]/8, inf))
Pbindef(\y, \amp, Pseq([Pn(Pdefn(\a3),3), Pdefn(\a4)], inf))
// listen
// https://soundcloud.com/tedthetrumpet/algodub01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment