-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfor_july.rb
328 lines (284 loc) · 7.14 KB
/
for_july.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
# Path definitions - using ~ instead of absolute paths
oboe = "~/devel/musicode/samples/Oboe"
bass_clarinet = "~/devel/musicode/samples/bassClarinets"
harp = "~/devel/musicode/samples/Harp"
# Helper function to list available samples
define :list_samples do |folder|
puts "Available samples in #{folder}:"
Dir.glob("#{folder}/*.{wav,WAV}").each do |file|
puts File.basename(file)
end
end
# Uncomment these to see available samples
# list_samples(oboe)
# list_samples(bass_clarinet)
# list_samples(harp)
# Example of safer sample loading
define :play_sample_if_exists do |folder, name|
full_path = "#{folder}/#{name}"
if File.exist?(full_path)
sample folder, name
else
puts "Warning: Sample not found: #{full_path}"
end
end
use_bpm 72 # Stately symphonic tempo
# Global variables for movement control
set :movement_1_done, false
set :movement_2_done, false
set :movement_3_done, false
set :finale_started, false
# Movement 1: "Dawn Awakening"
# Gentle harp arpeggios with bass clarinet foundation
define :movement_one do
puts "Movement 1: Dawn Awakening begins"
in_thread do
# Opening harp sequence - using actual available files
with_fx :reverb, room: 0.9, mix: 0.6 do
2.times do
["harp-c4.wav", "harp-f4.wav", "harp-a4.wav", "harp-c5.wav"].each do |note|
sample harp, note, amp: 0.6, attack: 0.1, release: 1.5
sleep 2
end
end
end
# Main harp theme
4.times do
with_fx :echo, phase: 0.75, decay: 4 do
sequence = [
["harp-c4.wav", "harp-f4.wav"],
["harp-a4.wav", "harp-c5.wav"],
["harp-f4.wav", "harp-a4.wav"],
["harp-c5.wav", "harp-f5.wav"]
]
sequence.each do |chord|
chord.each do |note|
sample harp, note,
amp: 0.5,
attack: 0.1,
release: 2.0
sleep 0.5
end
sleep 1
end
end
end
end
# Bass clarinet foundation - using actual files
in_thread do
8.times do
with_fx :reverb, room: 0.8 do
sample bass_clarinet, "bass_clarinet-d3.wav",
amp: 0.4,
attack: 0.3,
release: 2.0
sleep 4
sample bass_clarinet, "bass_clarinet-g3.wav",
amp: 0.4,
attack: 0.3,
release: 2.0
sleep 4
end
end
end
# Wait for movement to complete
sleep 64
set :movement_1_done, true
end
# Movement 2: "Pastoral Dialogue"
# Oboe and Bass Clarinet conversation
define :movement_two do
puts "Movement 2: Pastoral Dialogue begins"
in_thread do
# Oboe melody - using actual files
with_fx :reverb, room: 0.8, mix: 0.5 do
6.times do
2.times do
sample oboe, "oboe-e4.wav",
amp: 0.5,
attack: 0.1,
release: 1.5
sleep 3
sample oboe, "oboe-e5.wav",
amp: 0.4,
attack: 0.1,
release: 1.0
sleep 2
sample oboe, "oboes-c4.wav",
amp: 0.5,
attack: 0.1,
release: 2.0
sleep 3
end
sample oboe, "oboes-c5.wav",
amp: 0.4,
attack: 0.2,
release: 1.5
sleep 4
end
end
end
# Bass Clarinet response
in_thread do
6.times do
with_fx :reverb, room: 0.9 do
pattern = [
"bass_clarinet-b3.wav",
"bass_clarinet-g3.wav",
"bass_clarinet-d4.wav",
"bass_clarinet-f3.wav"
]
pattern.each do |note|
sample bass_clarinet, note,
amp: 0.45,
attack: 0.2,
release: 2.0
sleep 4
end
end
end
end
# Harp accompaniment
in_thread do
12.times do
with_fx :echo, phase: 0.5, decay: 2 do
sample harp, ["harp-c4.wav", "harp-a4.wav", "harp-f4.wav"].choose,
amp: 0.4,
attack: 0.1,
release: 1.5
sleep 4
end
end
end
# Wait for movement to complete
sleep 96
set :movement_2_done, true
end
# Movement 3: "Autumn Contemplation"
# Complex interweaving of all instruments
define :movement_three do
puts "Movement 3: Autumn Contemplation begins"
in_thread do
4.times do
with_fx :reverb, room: 0.9, mix: 0.6 do
["bass_clarinet-f2.wav", "bass_clarinet-b2.wav", "bass_clarinet-d3.wav"].each do |note|
2.times do
sample bass_clarinet, note,
amp: 0.5,
attack: 0.3,
release: 3.0
sleep 6
end
end
end
end
end
in_thread do
4.times do |i|
with_fx :reverb, room: 0.8 do
3.times do
sample oboe, "oboe-e4.wav",
amp: 0.4 + (i * 0.1),
attack: 0.2,
release: 2.0
sleep 4
sample oboe, "oboes-c5.wav",
amp: 0.35 + (i * 0.1),
attack: 0.1,
release: 1.5
sleep 4
end
sample oboe, "oboe-e5.wav",
amp: 0.4,
attack: 0.3,
release: 2.5
sleep 6
end
end
end
# Harp textures
in_thread do
8.times do |i|
with_fx :echo, phase: 0.75, decay: 4 do
# Ascending pattern
["harp-c4.wav", "harp-f4.wav", "harp-a4.wav", "harp-c5.wav"].each do |note|
sample harp, note,
amp: 0.45,
attack: 0.1,
release: 1.0
sleep 1
end
# Descending pattern
["harp-a4.wav", "harp-f4.wav", "harp-c4.wav"].each do |note|
sample harp, note,
amp: 0.4,
attack: 0.1,
release: 1.0
sleep 1
end
end
end
end
# Wait for movement to complete
sleep 128
set :movement_3_done, true
end
# Finale: "September's Farewell"
define :finale do
puts "Finale: September's Farewell begins"
set :finale_started, true
in_thread do
2.times do
with_fx :reverb, room: 0.95, mix: 0.7 do
["bass_clarinet-g4.wav", "bass_clarinet-d4.wav", "bass_clarinet-b3.wav"].each do |note|
sample bass_clarinet, note,
amp: 0.6,
attack: 0.4,
release: 3.0
sleep 6
end
end
end
end
in_thread do
sleep 12
2.times do
sample oboe, "oboe-e5.wav",
amp: 0.5,
attack: 0.3,
release: 2.5
sleep 8
sample oboe, "oboes-c5.wav",
amp: 0.45,
attack: 0.2,
release: 2.0
sleep 4
end
end
# Final harp cascade
with_fx :echo, phase: 1, decay: 6 do
sleep 24
["harp-c6.wav", "harp-a5.wav", "harp-f5.wav", "harp-c5.wav", "harp-a4.wav", "harp-f4.wav", "harp-c4.wav"].each do |note|
sample harp, note,
amp: 0.5,
attack: 0.1,
release: 2.0
sleep 2
end
end
end
# Main composition control
define :conduct_symphony do
movement_one
# Transition to Movement 2
sleep 4
movement_two
# Transition to Movement 3
sleep 6
movement_three
# Transition to Finale
sleep 8
finale
end
# Start the symphony
conduct_symphony