forked from euruband/sonic-pi-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lowenzahn.rb
337 lines (254 loc) · 6.93 KB
/
lowenzahn.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
# "Löwenzahn" - variation of the theme of a favorite german TV show for kids
tick = 0.7
half = 0.5*tick
quart = 0.5*half
total_length = 40
length = 4
# Some notes on the structure:
#
# First, we define all patterns.
# They are invoked below, each
# in a single "thread" (≡ live_loop)
#
# The live_loops created were synced to
# *one* single "frame", which is a live_loop, too
define :tusch do
length.to_i.times.each_with_index do |_, i|
sample :drum_splash_soft, amp: 0.35, release: 0.5*tick
sleep 3*tick
4.times do
sample :drum_bass_soft, amp: 0.5
sleep quart
end
end
end
define :beatx do
length.to_i.times.each_with_index do |_, i|
sleep half
sample :drum_cymbal_closed, amp: 0.25
sleep half
sample :bd_haus, amp: 0.3
end
end
define :main_bass_pattern do
play_chord Chord.new(:G2, :"1"), release: half
sleep tick
play_chord Chord.new(:G3, :"1"), release: half
sleep tick
play_chord Chord.new(:F3, :"1"), release: quart
sleep quart
play_chord Chord.new(:Fb3, :"1"), release: half
sleep half
play_chord Chord.new(:D3, :"1"), release: quart
sleep half
play_chord Chord.new(:D3, :"1"), release: 0.5*quart
sleep quart
play_chord Chord.new(:D3, :"1"), release: 0.5*quart
sleep quart
play_chord Chord.new(:D3, :"1"), release: 0.5*quart
sleep quart
end
define :shifted_bass_pattern do
play_chord Chord.new(:C3, :"1"), release: half
sleep tick
play_chord Chord.new(:C4, :"1"), release: half
sleep tick
play_chord Chord.new(:Bb3, :"1"), release: quart
sleep quart
play_chord Chord.new(:A3, :"1"), release: half
sleep half
play_chord Chord.new(:G3, :"1"), release: quart
sleep half
play_chord Chord.new(:G3, :"1"), release: 0.5*quart
sleep quart
play_chord Chord.new(:G3, :"1"), release: 0.5*quart
sleep quart
play_chord Chord.new(:G3, :"1"), release: 0.5*quart
sleep quart
end
define :swinging_shifted do
with_fx :echo, delay: 0.05, decay: 0.05 do
with_synth :fm do
play_chord Chord.new(:C4, :"1"), release: quart
sleep half
play_chord Chord.new(:C4, :"1"), release: quart
sleep half
sleep 3*tick
end
end
end
define :swinging do
with_fx :echo, delay: 0.05, decay: 0.05 do
with_synth :fm do
play_chord Chord.new(:G4, :"1"), release: quart
sleep half
play_chord Chord.new(:G4, :"1"), release: quart
sleep half
sleep 3*tick
end
end
end
define :dancing_tones do
with_synth :fm do
with_fx :compressor, amp: 4.0 do
sleep 3*tick
play_chord Chord.new(:G4, :"1"), release: quart
sleep quart # 0.25
play_chord Chord.new(:A4, :"1"), release: 0.5*quart
sleep quart # 0.5
play_chord Chord.new(:B4, :"1"), release: quart
sleep half # 1.0
# --- 4 ---
play_chord Chord.new(:B4, :"1"), release: quart
sleep 2.5*tick + quart + quart
play_chord Chord.new(:B4, :"1"), release: quart
sleep quart
play_chord Chord.new(:A4, :"1"), release: quart
sleep quart
play_chord Chord.new(:G4, :"1"), release: quart
sleep quart
play_chord Chord.new(:D4, :"1"), release: quart
sleep quart
play_chord Chord.new(:D4, :"1"), release: quart
sleep quart
play_chord Chord.new(:D4, :"1"), release: quart
sleep 3.25*tick
play_chord Chord.new(:G4, :"1"), release: quart
sleep quart # 0.25
play_chord Chord.new(:A4, :"1"), release: 0.5*quart
sleep quart # 0.5
# --- 12 ---
play_chord Chord.new(:B4, :"1"), release: quart
sleep half
play_chord Chord.new(:B4, :"1"), release: quart
sleep half
play_chord Chord.new(:B4, :"1"), release: quart
sleep quart
play_chord Chord.new(:A4, :"1"), release: quart
sleep quart
play_chord Chord.new(:G4, :"1"), release: quart
sleep quart
play_chord Chord.new(:D4, :"1"), release: quart
sleep tick + half + quart
play_chord Chord.new(:G4, :"1"), release: quart
sleep quart # 0.25
play_chord Chord.new(:A4, :"1"), release: 0.5*quart
sleep quart # 0.5
# --- 16 ---
play_chord Chord.new(:B4, :"1"), release: quart
sleep half
play_chord Chord.new(:B4, :"1"), release: quart
sleep half
play_chord Chord.new(:B4, :"1"), release: quart
sleep quart
play_chord Chord.new(:A4, :"1"), release: quart
sleep quart
play_chord Chord.new(:G4, :"1"), release: quart
sleep quart
play_chord Chord.new(:D5, :"1"), release: quart
sleep tick + half + quart
play_chord Chord.new(:D5, :"1"), release: quart
sleep quart # 0.25
play_chord Chord.new(:E5, :"1"), release: 0.5*quart
sleep quart # 0.5
# --- 20 ---
play_chord Chord.new(:F5, :"1"), release: quart
sleep half
play_chord Chord.new(:F5, :"1"), release: quart
sleep half
play_chord Chord.new(:F5, :"1"), release: quart
sleep quart
play_chord Chord.new(:E5, :"1"), release: quart
sleep quart
play_chord Chord.new(:D5, :"1"), release: quart
sleep quart
play_chord Chord.new(:C5, :"1"), release: quart
sleep half
play_chord Chord.new(:C5, :"1"), release: quart
sleep half + quart
play_chord Chord.new(:G4, :"1"), release: quart
sleep quart
play_chord Chord.new(:A4, :"1"), release: quart
sleep quart
play_chord Chord.new(:B4, :"1"), release: quart
sleep quart
play_chord Chord.new(:A4, :"1"), release: quart
sleep quart + 4*tick
end
end
end
define :bass_finish do
with_synth :fm do
with_fx :compressor, amp: 0.25 do
with_fx :distortion, distort: 0.3 do
4.times do
play_chord Chord.new(:B3, :"5"), release: half
sleep half
end
4.times do
play_chord Chord.new(:F3, :"5"), release: half
sleep half
end
play_chord Chord.new(:A3, :"5"), release: 4*tick
sleep 4*tick
end
end
end
end
# All previous definitions were
# invoked now
live_loop :beat_it do
sync :frame
loop do
beatx
end
end
live_loop :singing do
sync :frame
with_fx :compressor, amp: 0.4 do
loop do
2.times { swinging }
2.times { swinging_shifted }
sleep (total_length-16)*tick
end
end
end
live_loop :dancing_tones do
sync :frame
with_fx :compressor, amp: 0.4 do
loop do
sleep 3*4*tick
dancing_tones
end
end
end
live_loop :foundation do
sync :frame
with_fx :compressor, amp: 1.8 do
with_synth :fm do
loop do
2.times do
main_bass_pattern
end
2.times do
shifted_bass_pattern
end
4.times do
main_bass_pattern
end
1.times do
bass_finish
end
end
end
end
end
# The live_loop below ("frame")
# is the thread every other pattern
# is synced to
live_loop :frame do
cue :frame
loop do
tusch
end
end