// title: another livecoding rehearsal // author: tedthetrumpet // description: // More rehearsals towards a sort of algorave gig I've been offered, tidied up a bit. One run of this here https://soundcloud.com/tedthetrumpet/lcode-04-gmsnprep-05 // code: // setup Pdef.all.clear; Ndef.all.clear; ( SynthDef(\blip, { |out= 0, freq = 261.6255653006, nharm = 10, gate = 1, amp = 0.1| var sig = Blip.ar(freq * ((-2..2)/500 + 1), nharm); // five channels, detuned var env = EnvGen.kr(Env.adsr(), gate, doneAction:2); sig = sig * env; Out.ar(out, Splay.ar(sig) * amp) }).add ) ~hitzpath="/Users/jsimon/Music/SuperCollider Recordings/hitzamples/"; // various drum samples ~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 ) t = TempoClock(140/60).permanent_(true); ~mbus = Bus.audio(s, 2); Ndef(\m).put(0, { InFeedback.ar(~mbus, 2) }).fadeTime_(0.2).play; // actually never used! // go Pbindef(\b, \instrument, \blip) ~mel = {-12.rand}!16 Pbindef(\b, \scale, Scale.hexMajor7) Pbindef(\b, \degree, Pseq(~mel,inf)) Pbindef(\b, \dur, 1/4) Pbindef(\b, \out, ~mbus).play(t, quant:4) // <----------------- ~mel2 = {-12.rand}!32 Pbindef(\b, \degree, Pseq(~mel2,inf)) Pbindef(\b, \degree, Pseq([~mel, ~mel, ~mel2].flatten,inf)) // need to do something with nharm Pbindef(\b, \nharm, Prand((1..10), inf)) // varying the rhythm using amp, also guarantee a downbeat ~gr = ([1] ++ [{2.rand}!15]).flatten/10 Pbindef(\b, \amp, Pseq(~gr, inf)) // yeah! Pbindef(\d, \instrument, \bf).play(t, quant: 4) // main out fine for now Pbindef(\s, \buf, ~bufs.choose) // find a snarish sound Pbindef(\s, \amp, Pseq([0,1]/10, inf)) Pbindef(\s, \instrument, \bf).play(t, quant: 4) Pbindef(\s).stop // jam Pbindef(\d).stop Pbindef(\b).stop // revisit melody ~mel = {-12.rand}!16 ~mel2 = {-12.rand}!32 Pbindef(\b, \degree, Pseq([~mel, ~mel, ~mel2].flatten,inf)) t.sync(30/60, 30) // slowdown nb .sync is an extension s.record s.stopRecording thisProcess.platform.recordingsDir.openOS