-
Notifications
You must be signed in to change notification settings - Fork 3
/
1_Republic_distributedEvents.scd
129 lines (104 loc) · 3.02 KB
/
1_Republic_distributedEvents.scd
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// (1) distributed sounds
// for testing on a single machine, make a second server:
(
if (r.nameList.includes(\otto).not) {
y = SharedServer(\otto, NetAddr("127.0.0.1", 57108), r.defaultServerOptions, r.nextFreeID);
y.boot; y.makeWindow;
r.servers.put(\otto, y);
};
)
// make a synthdef
(
SynthDef(\zzz, {|out, amp = 0.1, sustain = 1, freq = 440, noise = 0.3, pan|
var env = EnvGen.ar(Env.perc(0.01, sustain), doneAction: 2) * amp;
var son = SinOsc.ar(freq * [1, 1.2], BrownNoise.ar * noise).sum;
Out.ar(out, Pan2.ar(son * env, pan));
}).share;
)
// play it on my own server,
// change the parameters :
(instrument: \zzz).play
(instrument: \zzz, amp: 0.5).play
(instrument: \zzz, amp: 0.1).play
(instrument: \zzz, freq: 500).play
(instrument: \zzz, freq: 2500).play
(instrument: \zzz, freq: 1500, amp: 0.5).play
(instrument: \zzz, sustain: 10).play
(instrument: \zzz, sustain: 1).play
(instrument: \zzz, sustain: 0.3).play
(instrument: \zzz, sustain: 0.1, amp: 0.5).play
(instrument: \zzz, sustain: 0.1, amp: 0.5, noise: 0.8).play
// r.s is the republic server - should also play locally
(instrument: \zzz, freq: 500, server: r.s).play
// r.s is the republic server - where: \all goes to all members
(instrument: \zzz, freq: 500, server: r.s, where: \all).play
// choose a random server:
(instrument: \zzz, freq: 500, server: r.servers.choose).play
// choose a specific server - if not found, plays locally
(instrument: \zzz, freq: 500, dur: 3,server: r.servers[\abc]).play
(instrument: \zzz, freq: 500, dur: 3,server: r.servers[\otto]).play
(instrument: \zzz, freq: 500, dur: 3,server: r.servers[\absentNoName]).play
// expansion is not working yet!
(instrument: \zzz, freq: 500, dur: 10, server: r.s, where: \all).play
(instrument: \zzz, freq: 500, server: r.s, where: [\otto, \abc]).play
// and another sound
(
SynthDef(\xxy, {|out, sustain = 1, freq = 440|
var env = Line.kr(0.1, 0, sustain, doneAction: 2);
var son = SinOsc.ar(freq * [1, 1.2, 1.5, 1.7]).sum;
Out.ar(out, son * env);
}).share;
)
(instrument: \xxy, freq: 500, server: t).play
// make a gui where you see all Tdefs (task proxies):
TdefAllGui(12);
// put together a little task that combines events, and
// plays them on some servers:
(
Tdef(\x2, {
var servers = r.servers.values.scramble.keep(7).postln;
inf.do { |i|
servers.do { |x, j|
(
instrument: \xxy,
server: x,
freq: 1000 + (((i % 13) + (i % 8)) * 100),
sustain: 0.5
).play;
0.125.wait;
}; };
}).play;
);
// if one server has a multichannel system,
// one can play events on all 8 chans of big system:
(
Tdef(\y, {
inf.do {
8.do { |i|
(
instrument: \xxy,
server: r.servers[\big],
freq: 1000 + ((i % 13) * 100),
sustain: 0.2,
amp: 0.02,
out: i
).play;
0.25.wait;
}; };
}).play;
);
(
Tdef(\x, {
var servers = r.servers.values.scramble.keep(4).postln;
inf.do { |i|
servers.do { |x, j|
(
instrument: [\xxy, \zzz].choose,
server: x.postln,
freq: 1000 + (100 * (i % 4)),
sustain: 0.2
).play;
0.1.wait;
}; };
}).play;
);