// title: livecoding 01 // author: tedthetrumpet // description: // Work-in-progress livecoding setup and example // code: // initialisation ( // pre-tidy up just in case Pdef.all.clear; Ndef.all.clear; s.waitForBoot{ // setup sample paths and \bf synth ~hitzpath="/Users/jsimon/Music/SuperCollider Recordings/hitzamples/"; // drums ~gampath="/Users/jsimon/Music/SuperCollider Recordings/soh/"; // gamelan ~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; ~mbus = Bus.audio(s, 2); Ndef(\m).put(0, { InFeedback.ar(~mbus, 2) }).fadeTime_(0.2).play; // tempo clocks t = TempoClock(140/60).permanent_(true); u = TempoClock(140/60 * 2/3).permanent_(true); s.sync; "SynthDef \\bf (args: buf, freq)".postcln; "~bufs with hitzamples loaded".postcln; "tempo clocks t & u".postcln; "Ndef \\m is mixer node, listning to ~mbus".postcln; nil.value; }; ) // useful ~bufs = (~gampath ++ "*.aiff").pathMatch.collect({ |i| Buffer.read(s, i)}); (~gr = {2.0.linrand}!16/2; bindef(\x, \amp, Pseq(~gr/5, inf))) ~dr=({2.rand}!16.rand).normalizeSum*4; // array of variable length, always sums to 4 (~dr={2.rand}.dup([4,8,16,32].choose).normalizeSum*4; choose array lengths Pbindef(\x, \dur, Pseq(~dr, inf))) Pdef.all.asCompileString; //////////////////// // livecoding example Pbindef(\x, \instrument, \bf, \out, ~mbus).play(t, quant: 4) Ndef(\m).put(2, \filter -> { |in| JPverb.ar(in, t60:0.1)}) Ndef(\m).put(1, \filter -> { |in| Decimator.ar(in, rate: 200)}) Ndef(\m).put(1, \filter -> { |in| Decimator.ar(in, rate: Ndef(\l))}) Ndef(\m).put(2, nil) Ndef(\l, {LFNoise0.ar(10).range(200,600)}) Ndef(\l2, {LFNoise0.ar(~t*4).range(0.1,1)}) Ndef(\z).play.fadeTime_(2) Ndef(\z).stop Ndef(\z, {Blip.ar((100..120), 10 * Ndef(\l2))*0.08}) ~t=t.tempo t.sync(160/60, 30) u.sync(160/60, 10) Pbindef(\x, \buf, ~bufs.choose) Pbindef(\x, \buf, Pseq({~bufs.choose}!4,inf)) Pbindef(\x, \note, -12) Pbindef(\x, \note, -12.rand) Pbindef(\x, \note, Pfunc({-24.rand})) Pbindef(\x, \note, Pseq({-24.rand}!16,inf)) Pbindef(\x, \dur, Pseq([1,1,0.5,0.5,1,1,1,1,0.5,0.5].scramble/2,inf)) Pbindef(\x, \amp, 0.3)