«livecoding 01» by tedthetrumpet

on 10 Jun'16 17:10 in livecoding

Work-in-progress livecoding setup and example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// 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)
raw 2237 chars (focus & ctrl+a+c to copy)
reception
comments