aboutsummaryrefslogtreecommitdiff
path: root/include/sequence_sections.inc
blob: c88500c780a13e91c159df70db9ee7c6c48aab57 (plain)
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
#ifndef INC_SECTION_SEQ
#define INC_SECTION_SEQ ##
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

	Partial Emergence
		by Richard Knight 2022

	Installation submission for the International Csound Conference 2022

	Section subsequencers

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#include "sonics/bussing.udo"
#include "include/instruments_water.inc"
#include "include/instruments_idiophone.inc"
#include "include/instruments_synthesis.inc"


/*
	Pause the melodic progression for the duration of the calling instrumnet
*/
opcode pause_melprogression, 0, 0
	gkmel_pause = 1
	if (lastcycle() == 1) then
		gkmel_pause = 0
	endif
endop


/*
	Call an instrument for outward transition; p4 is passed as the rise ratio of total duration
*/
opcode transition_out, 0, S
	Sinstrument xin
	iduration = random(4, min(12, p3*0.5))
	iriseratio = random(0.5, 0.9)
	schedule(Sinstrument, p3 - (iduration * iriseratio), iduration, iriseratio)
endop


/*
	Call an instrument for inward transition; p4 is passed as short duration for an almost immediate attack
*/
opcode transition_in, 0, S
	Sinstrument xin
	iduration = random(3, min(10, p3*0.25))
	schedule(Sinstrument, 0, iduration, 0.03)
endop


instr sequencer_s0
	transition_in("transition_idiophone_randtime")
	imaxlen = p3
	itime = 0
	while (itime < imaxlen) do
		idur = random(5, 10)
		idur = (idur + itime > imaxlen) ? imaxlen - itime : idur
		schedule("phrase_idiophone1", itime, idur, 1)
		itime += random(idur*0.6, idur*0.8)
	od
	transition_out("transition_idiophone_stretch1")
endin


instr sequencer_s1
	schedule("phrase_idiophone_stretch1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 0)
	schedule("phrase_idiophone1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 1)

	kdo init 0
	if (gkmel_section_change == 1) then
		klen = mel_length:k()
		schedulek("phrase_idiophone_stretch1", 0, klen*random:k(1, 1.5), 0)

		if (kdo == 0) then
			schedulek("phrase_idiophone1", 0, klen*random:k(1, 1.3), 0)	; chords
			kdo = 1
		else
			kdo = 0
		endif
	endif
	transition_out("transition_idiophone_randtime")
endin


instr sequencer_s2
	
	schedule("note_bass1", 0, p3, 0)
	schedule("phrase_idiophone1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 1)

	if (gkmel_section_change == 1) then
		klen = mel_length:k()
		schedulek("phrase_idiophone1", 0, klen, 1) ; single note only
		schedulek("phrase_idiophone_stretch1", 0, klen*1.3, 0)
	endif
	
	if (lastcycle:k() == 1) then
		turnoff2("note_bass1", 0, 1)
	endif

endin


instr sequencer_s3
	schedule("note_bass1", 0, p3, 0)
	schedule("phrase_idiophone_stretch1", 0, i(gkseq_beattime) * i(gkmel_section_change_due), 1)

	if (gkmel_section_change == 1) then
		klen = mel_length:k()
		schedulek("phrase_idiophone1", 0, klen, 0) ; chords
		schedulek("phrase_idiophone_stretch1", 0, klen*0.8, 1)
	endif

	if (lastcycle:k() == 1) then
		turnoff2("note_bass1", 0, 1)
	endif

endin


instr sequencer_s4
	idiophone_change()
	schedule("phrase_dropstretch1", 0, i(gkseq_beattime) * 2 * i(gkmel_section_change_due), random(0.5, 1.5), 1, 1, 0.5)
	if (gkmel_section_change == 1) then
		klen = mel_length:k()
		schedulek("phrase_idiophone1", 0, klen, 1)	; single note only
		schedulek("phrase_idiophone_stretch1", 0, klen*1.3, 1)
	endif
	transition_out("transition_waterbubbler1")
endin


instr sequencer_s5
	imaxlen = p3
	itime = 0
	while (itime < imaxlen) do
		idur = random(5, 20)
		schedule("phrase_dropstretch1", itime, idur, random(0.5, 1.5), 1, 1, 1)
		if (random(0, 1) > 0.5) then
			schedule("phrase_dropstretch1", itime + random(0, 5), idur, random(0.5, 1.5), 1, 1, 2)
		endif
	
		if (random(0, 1) > 0.5) then ; no reson
			schedule("phrase_dropstretch1", itime + random(0, 5), idur, random(0.5, 1.5), 0, 1, 1)
		endif

		if (random(0, 1) > 0.5) then
			schedule("phrase_waterbubbler1", itime, idur, 1)
		endif

		if (random(0, 1) > 0.5) then
			schedule("play_waterpaddling1", itime + random(0, 5), 1)
		endif

		itime += idur * random(0.5, 0.8)
	od
endin


instr sequencer_s6
	schedule("phrase_dropstretch1", 0, i(gkseq_beattime) * 1.5 * i(gkmel_section_change_due), random(0.5, 1.5), 0, 1, 1)
	
	if (gkmel_section_change == 1) then
		;turnoff2 "phrase_idiophone_stretch2", 0, 1
		schedulek("phrase_idiophone_stretch2", 0, mel_length:k()*1.3, 0)
		schedulek("phrase_waterbubbler1", 0, mel_length:k(), 0)
	endif

	awL, awR bus_read "phrase_waterbubbler"
	amL, amR bus_read "note_idiophonestretch2"
	
	ir = 256
	irm = 2
	fwL pvsanal awL, ir, ir/irm, ir, 1
	fwR pvsanal awR, ir, ir/irm, ir, 1
	fmL pvsanal amL, ir, ir/irm, ir, 1
	fmR pvsanal amR, ir, ir/irm, ir, 1
	fxL pvsmorph fwL, fmL, 0, 1
	fxR pvsmorph fwR, fmR, 0, 1
	aL pvsynth fxL
	aR pvsynth fxR
	kamp linseg 0, p3*0.01, 1, p3*0.98, 1, p3*0.01, 0 ; has click at start
	bus_mix("main", aL*kamp, aR*kamp)
endin


instr sequencer_s7
	idiophone_change()
	schedule("phrase_dropstretch1", 0, i(gkseq_beattime) * 1.5 * i(gkmel_section_change_due), random(0.5, 1.5), 1, 1, 8)
	if (gkmel_section_change == 1) then
		schedulek("phrase_idiophone_stretch2", 0, mel_length:k()*1.3, 0)
		schedulek("phrase_waterbubbler1", 0, mel_length:k(), 1)
	endif

	aL, aR bus_read "note_idiophonestretch2"
	bus_mix("delay1", aL*0.2, aR*0.2)
	bus_mix("main", aL*0.8, aR*0.8)
	transition_out("transition_idiophone_randtime")
endin


instr sequencer_s8
	pause_melprogression()
	imaxlen = p3
	itime = 0
	while (itime < imaxlen) do
		idur = random(p3*0.1, p3*0.3)
		idur = (idur + itime > imaxlen) ? imaxlen - itime : idur
		schedule("phrase_dropstretch1", itime, idur, random(0.5, 1.5), 1, 1, 0.5)
		if (random(0, 1) > 0.5) then
			schedule("phrase_dropstretch1", itime + random(0, 5), idur, random(0.5, 1.5), 1, 1, 2)
		endif
	
		if (random(0, 1) > 0.5) then ; no reson
			schedule("phrase_dropstretch1", itime + random(0, 5), idur, random(0.5, 1.5), 0, 1, 1)
		endif

		if (random(0, 1) > 0.2) then
			schedule("play_waterpaddling1", itime + random(0, 5), random(0.5, 6))
			if (random(0, 1) > 0.6) then
				schedule("play_waterpaddling1", itime + random(0, 5), random(0.5, 6))
			endif
		endif
		itime += idur * random(0.5, 1.2)
	od
	transition_out("transition_idiophone_gliss1")
endin


instr sequencer_s9
	transition_in("transition_idiophone_stretch1")
	idiophone_change()
	gimel_portamento_beatratio = 0.4
	imaxlen = p3
	itime = 0
	while (itime < imaxlen) do
		idur = random(5, 20)
		idur = (idur + itime > imaxlen) ? imaxlen - itime : idur
		schedule("phrase_idiophone_stretch3", itime, idur)
		itime += idur
	od
	transition_out("transition_idiophone_stretch1")
endin


instr sequencer_s10
	transition_in("transition_idiophone_randtime")
	gimel_portamento_beatratio = 0.4
	schedule("phrase_idiophone_stretch4", 0, p3)
	schedule("note_bass1", 0, p3, 0)

	kmetrofreq = abs:k(oscil:k(5, 0.01)) + 0.1
	knotemetro = metro(kmetrofreq)
	if (knotemetro == 1) then
		if (random:k(0, 1) > 0.8) then
			kstart = random:k(0, 0.3)
			schedulek("note_hybrid1", kstart, 1, mel_randomnote:k())
			;schedulek("_note_idiophone1", kstart, 0.1, mel_randomnote:k()+12, random:k(2, 7))
			;schedulek("note_drop1", kstart, 0.5)
		endif
	endif

	kdroprollmetro = metro(0.1)
	if (kdroprollmetro == 1 && random:k(0, 1) > 0.5) then
		schedulek("fnmi_sineblips", random:k(0, 2), random:k(3, 10), "reverb1")
		schedulek("phrase_droproll1", random:k(0, 2), random:k(3, 10), 1)
	endif

endin


instr sequencer_s11
	transition_in("transition_idiophone_gliss1")
	; resonated droplets
	kmetrofreq = abs:k(oscil:k(3, 0.01)) + 0.1
	knotemetro = metro(kmetrofreq)
	if (knotemetro == 1) then
		if (random:k(0, 1) > 0.5) then
			schedulek("note_hybrid1", random:k(0, 0.3), 1, mel_randomnote:k())
			if (random:k(0, 1) > 0.5) then
				schedulek("note_hybrid1", random:k(0.3, 1), 1, mel_randomnote:k()+12)
			endif
		endif
	endif

	; water droplets
	kdroprollmetro = metro(0.2)
	if (kdroprollmetro == 1 && random:k(0, 1) > 0.5) then
		schedulek("phrase_droproll1", random:k(0, 2), random:k(3, 10), 0.2)
	endif

	; subtle notes
	if (gkmel_section_change == 1) then
		schedulek("note_idiophonestretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0)
		schedulek("note_idiophonestretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0)
		if (random:k(0, 1) > 0.5) then
			schedulek("note_idiophonestretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0)
			schedulek("note_idiophonestretch1", random:k(0, 2), random:k(4, 12), mel_randomnote:k()-12, 0)
		endif

		; paddling stretch
		schedulek("play_waterpaddling1", random:k(0, 2), random:k(3, 15))

		; bass note
		if (random:k(0, 1) > 0.4) then
			klen = mel_length:k()
			schedulek("note_bass2", random:k(0, 3), random:k(klen, klen*1.5), 0)
		endif
	endif
endin


instr sequencer_s12
	kmetrofreq = abs:k(oscil:k(3, 0.01)) + 0.1
	knotemetro = metro(kmetrofreq)
	if (knotemetro == 1) then
		if (random:k(0, 1) > 0.5) then
			schedulek("note_hybrid1", random:k(0, 0.3), 1, mel_randomnote:k()-12)
		endif
		if (random:k(0, 1) > 0.5) then
			schedulek("note_hybrid1", random:k(0.3, 1), 1, mel_randomnote:k())
		endif
		if (random:k(0, 1) > 0.5) then
			kstart = random:k(0.3, 1)
			schedulek("note_hybrid1", kstart, 1, mel_randomnote:k()+24)
			if (random:k(0, 1) > 0.5) then
				schedulek("note_drop1", kstart, 1)
			endif
		endif
		if (random:k(0, 1) > 0.9) then
			schedulek("phrase_dropstretch1", random:k(0, 3), random:k(4, 7), 2, round:k(random:k(0, 1)), 1, 2)
			schedulek("note_bass2", random:k(0, 3), random:k(4, 5), 0)
		endif
	endif
	schedule("phrase_droproll1", 0, 1, 2.4)
endin


instr sequencer_s13
	if (random(0, 1) >= 0.5) then
		pause_melprogression()
	endif
	idiophone_change()
	iplayidiophone = round(random(0, 1))
	kmetrofreq expseg 0.3, p3, 20
	knotemetro = metro(kmetrofreq)
	if (knotemetro == 1) then
		if (random:k(0, 1) > 0.5) then
			schedulek("note_hybrid1", random:k(0, 0.3), 1, mel_randomnote:k()+12)
			if (iplayidiophone == 1 && active:k("note_idiophonestretch1") == 0) then
				schedulek("note_idiophonestretch1", random:k(0, 2), random:k(1, 3), mel_randomnote:k()-12, 0)
			endif
		endif
		if (random:k(0, 1) > 0.5) then
			schedulek("note_hybrid1", random:k(0.3, 1), 1, mel_randomnote:k())
		endif
		if (random:k(0, 1) > 0.5) then
			kstart = random:k(0.3, 1)
			schedulek("note_hybrid1", kstart, 1, mel_randomnote:k()-12)
			if (random:k(0, 1) > 0.5) then
				schedulek("note_drop1", kstart, 1)
			endif
		endif
	endif
	schedule("phrase_droproll1", 0, 1.3, 2.4)
endin


instr sequencer_s14
	gimel_portamento_beatratio = 0.2
	imaxlen = p3
	iplaydrops = round(random(0, 1))
	itime = 0
	while (itime < imaxlen) do
		idur = random(5, 20)
		idur = (idur + itime > imaxlen) ? imaxlen - itime : idur
		schedule("phrase_hybridstretch1", itime, idur)
		if (iplaydrops == 1) then
			schedule("phrase_droproll1", itime, idur, 0.4)
		endif
		itime += idur
	od

	; play one music box glissando just before the next mel section change
	kglissset init 0
	if (kglissset == 0 && gkmel_section_change == 1) then
		schedulek("phrase_idiophone_gliss1", mel_length:k()-0.5, 1, 3)
		kglissset = 1
	endif

	; water transition out
	transition_out("transition_droplets1")
endin


instr sequencer_s15
	transition_in("transition_idiophone_gliss1")
	idiophone_change()
	pause_melprogression()

	;schedule("phrase_idiophone1", 0, p3, 0)
	schedule("phrase_hybrid2", 0, p3, 0)
	transition_out("transition_waterbubbler1")
endin


instr sequencer_s16
	idiophone_change()
	imaxlen = p3
	itime = 0
	while (itime < imaxlen) do
		idur = random(5, 20)
		idur = (idur + itime > imaxlen) ? imaxlen - itime : idur
		schedule("phrase_hybrid1", itime, idur)
		itime += idur
	od
	transition_out("transition_idiophone_gliss1")
endin


instr sequencer_s17
	pause_melprogression()
	imaxlen = p3
	itime = 0
	while (itime < imaxlen) do
		schedule("note_idiophone_randtime", itime+random(0, 1), random(2, 5))
		schedule("note_idiophone_randtime", itime+random(0, 4), random(2, 5))
		schedule("play_waterpaddling1", itime+random(0, 1), random(1, 2))
		itime += random(5, 20)
	od

	schedule("phrase_dropstretch1", 0, p3, 1, 1, 1, 1)
	schedule("phrase_dropstretch1", 0, p3, 2, 1, 1, 0.5)
	transition_out("transition_droplets1")
endin



#end