-
Notifications
You must be signed in to change notification settings - Fork 1
/
sequencer.rb
350 lines (314 loc) · 7.66 KB
/
sequencer.rb
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
use_osc "localhost", 4560
live_loop :getbpm do
use_real_time
bpm = sync "/osc*/bpm"
set :globalBpm, bpm[0]
end
live_loop :getsynth do
use_real_time
synth = sync "/osc*/synth"
set :synth, synth[0]
end
live_loop :getbool do
use_real_time
base = sync "/osc*/sec"
set :baseBool, base[0]
set :hihtBool, base[1]
set :snareBool, base[2]
set :percBool, base[3]
end
live_loop :getmldybool do
use_real_time
mldybool = sync "/osc*/mldytime"
set :mldyBool1, mldybool[0]
set :mldyBool2, mldybool[1]
set :mldyBool3, mldybool[2]
set :mldyBool4, mldybool[3]
set :mldyBool5, mldybool[4]
set :mldyBool6, mldybool[5]
set :mldyBool7, mldybool[6]
set :mldyBool8, mldybool[7]
end
live_loop :getamp do
use_real_time
amp = sync "/osc*/amp"
set :globalAmp, amp[0]
set :bamp, amp[1]
set :hamp, amp[2]
set :samp, amp[3]
set :pamp, amp[4]
set :mamp, amp[5]
end
live_loop :getrate do
use_real_time
rate = sync "/osc*/rate"
set :brate, rate[0]
set :hrate, rate[1]
set :srate, rate[2]
set :prate, rate[3]
end
live_loop :getattk do
use_real_time
attack = sync "/osc*/attk"
set :battk, attack[0]
set :hattk, attack[1]
set :sattk, attack[2]
set :pattk, attack[3]
set :mattk, attack[4]
end
live_loop :getrelease do
use_real_time
release = sync "/osc*/rel"
set :brel, release[0]
set :hrel, release[1]
set :srel, release[2]
set :prel, release[3]
set :mrel, release[4]
end
live_loop :getmldy do
use_real_time
melody = sync "/osc*/mldy"
set :tune, melody[0]
end
live_loop :getslicer do
use_real_time
slicer = sync "/osc*/slice"
set :slicerwave, slicer[0]
set :slicerbool, slicer[1]
end
live_loop :_base do
use_real_time
bbool = get(:baseBool)
baserate = get(:brate)
sample :bd_klub, amp: (get(:globalAmp) * get(:bamp)) * bbool, rate: baserate, attack: get(:battk), release: get(:brel)
sleep get(:globalBpm)
end
live_loop :_hiht do
use_real_time
hbool = get(:hihtBool)
hihtrate = get(:hrate)
sample :drum_cymbal_closed, amp: (get(:globalAmp) * get(:hamp)) * hbool, rate: hihtrate, attack: get(:hattk), release: get(:hrel)
sleep get(:globalBpm)
end
live_loop :_snare do
use_real_time
sbool = get(:snareBool)
snarerate = get(:srate)
sample :drum_snare_soft, amp: (get(:globalAmp) * get(:samp)) * sbool, rate: snarerate, attack: get(:sattk), sustain: 1, release: get(:srel)
sleep get(:globalBpm)
end
live_loop :_perc do
use_real_time
pbool = get(:percBool)
percrate = get(:prate)
sample :perc_snap, amp: (get(:globalAmp) * get(:pamp)) * pbool, rate: percrate, attack: get(:pattk), release: get(:prel)
sleep get(:globalBpm)
end
live_loop :_melody do
use_real_time
bamp = get(:globalAmp)
mbool = get(:mldyBool1)
synth = get(:synth)
with_fx :slicer, phase: 0.25, wave: get(:slicerwave), mix: get(:slicerbool) do
if (mbool == 1)
if (synth == 0)
use_synth :piano
end
if (synth == 1)
use_synth :prophet
end
if (synth == 2)
use_synth :dark_ambience
end
if (synth == 3)
use_synth :blade
end
play get(:tune), amp: (get(:globalAmp) * get(:mamp)) * mbool, attack: get(:mattk), decay: get(:mrel)
sleep get(:globalBpm) * 2
else
sleep get(:globalBpm)
end
end
end
live_loop :_melody2 do
use_real_time
bamp = get(:globalAmp)
mbool = get(:mldyBool2)
synth = get(:synth)
with_fx :slicer, phase: 0.25, wave: get(:slicerwave), mix: get(:slicerbool) do
if (mbool == 1)
if (synth == 0)
use_synth :piano
end
if (synth == 1)
use_synth :prophet
end
if (synth == 2)
use_synth :dark_ambience
end
if (synth == 3)
use_synth :blade
end
play get(:tune), amp: (get(:globalAmp) * get(:mamp)) * mbool, attack: get(:mattk), decay: get(:mrel)
sleep get(:globalBpm) * 2
else
sleep get(:globalBpm)
end
end
end
live_loop :_melody3 do
use_real_time
bamp = get(:globalAmp)
mbool = get(:mldyBool3)
synth = get(:synth)
with_fx :slicer, phase: 0.25, wave: get(:slicerwave), mix: get(:slicerbool) do
if (mbool == 1)
if (synth == 0)
use_synth :piano
end
if (synth == 1)
use_synth :prophet
end
if (synth == 2)
use_synth :dark_ambience
end
if (synth == 3)
use_synth :blade
end
play get(:tune), amp: (get(:globalAmp) * get(:mamp)) * mbool, attack: get(:mattk), decay: get(:mrel)
sleep get(:globalBpm) * 2
else
sleep get(:globalBpm)
end
end
end
live_loop :_melody4 do
use_real_time
bamp = get(:globalAmp)
mbool = get(:mldyBool4)
synth = get(:synth)
with_fx :slicer, phase: 0.25, wave: get(:slicerwave), mix: get(:slicerbool) do
if (mbool == 1)
if (synth == 0)
use_synth :piano
end
if (synth == 1)
use_synth :prophet
end
if (synth == 2)
use_synth :dark_ambience
end
if (synth == 3)
use_synth :blade
end
play get(:tune), amp: (get(:globalAmp) * get(:mamp)) * mbool, attack: get(:mattk), decay: get(:mrel)
sleep get(:globalBpm) * 2
else
sleep get(:globalBpm)
end
end
end
live_loop :_melody5 do
use_real_time
bamp = get(:globalAmp)
mbool = get(:mldyBool5)
synth = get(:synth)
with_fx :slicer, phase: 0.25, wave: get(:slicerwave), mix: get(:slicerbool) do
if (mbool == 1)
if (synth == 0)
use_synth :piano
end
if (synth == 1)
use_synth :prophet
end
if (synth == 2)
use_synth :dark_ambience
end
if (synth == 3)
use_synth :blade
end
play get(:tune), amp: (get(:globalAmp) * get(:mamp)) * mbool, attack: get(:mattk), decay: get(:mrel)
sleep get(:globalBpm) * 2
else
sleep get(:globalBpm)
end
end
end
live_loop :_melody6 do
use_real_time
bamp = get(:globalAmp)
mbool = get(:mldyBool6)
synth = get(:synth)
with_fx :slicer, phase: 0.25, wave: get(:slicerwave), mix: get(:slicerbool) do
if (mbool == 1)
if (synth == 0)
use_synth :piano
end
if (synth == 1)
use_synth :prophet
end
if (synth == 2)
use_synth :dark_ambience
end
if (synth == 3)
use_synth :blade
end
play get(:tune), amp: (get(:globalAmp) * get(:mamp)) * mbool, attack: get(:mattk), decay: get(:mrel)
sleep get(:globalBpm) * 2
else
sleep get(:globalBpm)
end
end
end
live_loop :_melody7 do
use_real_time
bamp = get(:globalAmp)
mbool = get(:mldyBool7)
synth = get(:synth)
with_fx :slicer, phase: 0.25, wave: get(:slicerwave), mix: get(:slicerbool) do
if (mbool == 1)
if (synth == 0)
use_synth :piano
end
if (synth == 1)
use_synth :prophet
end
if (synth == 2)
use_synth :dark_ambience
end
if (synth == 3)
use_synth :blade
end
play get(:tune), amp: (get(:globalAmp) * get(:mamp)) * mbool, attack: get(:mattk), decay: get(:mrel)
sleep get(:globalBpm) * 2
else
sleep get(:globalBpm)
end
end
end
live_loop :_melody8 do
use_real_time
bamp = get(:globalAmp)
mbool = get(:mldyBool8)
synth = get(:synth)
with_fx :slicer, phase: 0.25, wave: get(:slicerwave), mix: get(:slicerbool) do
if (mbool == 1)
if (synth == 0)
use_synth :piano
end
if (synth == 1)
use_synth :prophet
end
if (synth == 2)
use_synth :dark_ambience
end
if (synth == 3)
use_synth :blade
end
play get(:tune), amp: (get(:globalAmp) * get(:mamp)) * mbool, attack: get(:mattk), decay: get(:mrel)
sleep get(:globalBpm) * 2
else
sleep get(:globalBpm)
end
end
end