aboutsummaryrefslogtreecommitdiff
path: root/patches/feb05/bay.orc
blob: 78edb681b03b638afce66488210ea7e560cfc0e3 (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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
; ================================================================
; Header
; ================================================================
sr=44100
kr=882
ksmps=50
nchnls=2

; ================================================================
; Globals
; ================================================================
zakinit 10,10

; Global variable for the reverb unit
ga1 init 0

; ================================================================
; Tables
; ================================================================
; Waveform for the string-pad
iwave ftgen 1, 0, 4096, 10, 1, .5, .33, .25,  .0, .1,  .1, .1

; Senoid required by chorus
isine ftgen 2, 0, 4096, 10, 1


; ================================================================
; Instruments
; ================================================================


instr 1	;String pad
; String-pad borrwoed from the piece "Dorian Gray",
; http://akozar.spymac.net/music/ Modified to fit my needs

;  ihz  = p4
;  idb  = p5/127 * 70    ; rescale MIDI velocity to 70db
;  ipos = p6
;  iamp = ampdb(idb)

; modified by dmorelli
khz	invalue	"hz1"
kpos invalue "pos1"
kamp  invalue "amp1"
kctrl = kamp*70
kctrl =	ampdb(kctrl)
  ; Slow attack and release
;  kctrl   linseg  0, p3/4, iamp, p3/2, 0  
  ; Slight chorus effect
  afund   oscil   kctrl, khz, 1            ; audio oscillator
  acel1   oscil   kctrl, khz - .1, 1       ; audio oscillator - flat
  acel2   oscil   kctrl, khz + .1, 1       ; audio oscillator - sharp
  asig    =   afund + acel1 + acel2

  ; Cut-off high frequencies depending on midi-velocity
  ; (larger velocity implies more brighter sound)
  asig butterlp asig, (p5-60)*40+900
 
  ; Panning
  kppan =       kpos*1.570796325  ; half of PI (radians of 90o angle)
  kpleft        =       cos(kppan)        ; half sign "down"
  kpright       =       sin(kppan)        ; half sign "up"
  asig1 = asig*kpleft;
  asig2 = asig*kpright;
  ; To the chorus effect, through zak channels 1 and 2
  zawm asig1, 1
  zawm asig2, 2
endin


instr 2	;String pad
; String-pad borrwoed from the piece "Dorian Gray",
; http://akozar.spymac.net/music/ Modified to fit my needs

;  ihz  = p4
;  idb  = p5/127 * 70    ; rescale MIDI velocity to 70db
;  ipos = p6
;  iamp = ampdb(idb)

; modified by dmorelli
khz	invalue	"hz2"
kpos invalue "pos2"
kamp  invalue "amp2"
kctrl = kamp*70
kctrl =	ampdb(kctrl)
  ; Slow attack and release
;  kctrl   linseg  0, p3/4, iamp, p3/2, 0  
  ; Slight chorus effect
  afund   oscil   kctrl, khz, 1            ; audio oscillator
  acel1   oscil   kctrl, khz - .1, 1       ; audio oscillator - flat
  acel2   oscil   kctrl, khz + .1, 1       ; audio oscillator - sharp
  asig    =   afund + acel1 + acel2

  ; Cut-off high frequencies depending on midi-velocity
  ; (larger velocity implies more brighter sound)
  asig butterlp asig, (p5-60)*40+900
 
  ; Panning
  kppan =       kpos*1.570796325  ; half of PI (radians of 90o angle)
  kpleft        =       cos(kppan)        ; half sign "down"
  kpright       =       sin(kppan)        ; half sign "up"
  asig1 = asig*kpleft;
  asig2 = asig*kpright;
  ; To the chorus effect, through zak channels 1 and 2
  zawm asig1, 1
  zawm asig2, 2
endin

instr 3	;String pad
; String-pad borrwoed from the piece "Dorian Gray",
; http://akozar.spymac.net/music/ Modified to fit my needs

 ; ihz  = p4
;  idb  = p5/127 * 70    ; rescale MIDI velocity to 70db
;  ipos = p6
;  iamp = ampdb(idb)

; modified by dmorelli
khz	invalue	"hz3"
kpos invalue "pos3"
kamp  invalue "amp3"
kctrl = kamp*70
kctrl =	ampdb(kctrl)
  ; Slow attack and release
;  kctrl   linseg  0, p3/4, iamp, p3/2, 0  
  ; Slight chorus effect
  afund   oscil   kctrl, khz, 1            ; audio oscillator
  acel1   oscil   kctrl, khz - .1, 1       ; audio oscillator - flat
  acel2   oscil   kctrl, khz + .1, 1       ; audio oscillator - sharp
  asig    =   afund + acel1 + acel2

  ; Cut-off high frequencies depending on midi-velocity
  ; (larger velocity implies more brighter sound)
  asig butterlp asig, (p5-60)*40+900
 
  ; Panning
  kppan =       kpos*1.570796325  ; half of PI (radians of 90o angle)
  kpleft        =       cos(kppan)        ; half sign "down"
  kpright       =       sin(kppan)        ; half sign "up"
  asig1 = asig*kpleft;
  asig2 = asig*kpright;
  ; To the chorus effect, through zak channels 1 and 2
  zawm asig1, 1
  zawm asig2, 2
endin


instr 4	;String pad
; String-pad borrwoed from the piece "Dorian Gray",
; http://akozar.spymac.net/music/ Modified to fit my needs

;  ihz  = p4
;  idb  = p5/127 * 70    ; rescale MIDI velocity to 70db
;  ipos = p6
;  iamp = ampdb(idb)

; modified by dmorelli
khz	invalue	"hz4"
kpos invalue "pos4"
kamp  invalue "amp4"
kctrl = kamp*70
kctrl =	ampdb(kctrl)
  ; Slow attack and release
;  kctrl   linseg  0, p3/4, iamp, p3/2, 0  
  ; Slight chorus effect
  afund   oscil   kctrl, khz, 1            ; audio oscillator
  acel1   oscil   kctrl, khz - .1, 1       ; audio oscillator - flat
  acel2   oscil   kctrl, khz + .1, 1       ; audio oscillator - sharp
  asig    =   afund + acel1 + acel2

  ; Cut-off high frequencies depending on midi-velocity
  ; (larger velocity implies more brighter sound)
  asig butterlp asig, (p5-60)*40+900
 
  ; Panning
  kppan =       kpos*1.570796325  ; half of PI (radians of 90o angle)
  kpleft        =       cos(kppan)        ; half sign "down"
  kpright       =       sin(kppan)        ; half sign "up"
  asig1 = asig*kpleft;
  asig2 = asig*kpright;
  ; To the chorus effect, through zak channels 1 and 2
  zawm asig1, 1
  zawm asig2, 2
endin

instr 5	;String pad
; String-pad borrwoed from the piece "Dorian Gray",
; http://akozar.spymac.net/music/ Modified to fit my needs

;  ihz  = p4
;  idb  = p5/127 * 70    ; rescale MIDI velocity to 70db
;  ipos = p6
;  iamp = ampdb(idb)

; modified by dmorelli
khz	invalue	"hz5"
kpos invalue "pos5"
kamp  invalue "amp5"
kctrl = kamp*70
kctrl =	ampdb(kctrl)
  ; Slow attack and release
;  kctrl   linseg  0, p3/4, iamp, p3/2, 0  
  ; Slight chorus effect
  afund   oscil   kctrl, khz, 1            ; audio oscillator
  acel1   oscil   kctrl, khz - .1, 1       ; audio oscillator - flat
  acel2   oscil   kctrl, khz + .1, 1       ; audio oscillator - sharp
  asig    =   afund + acel1 + acel2

  ; Cut-off high frequencies depending on midi-velocity
  ; (larger velocity implies more brighter sound)
  asig butterlp asig, (p5-60)*40+900
 
  ; Panning
  kppan =       kpos*1.570796325  ; half of PI (radians of 90o angle)
  kpleft        =       cos(kppan)        ; half sign "down"
  kpright       =       sin(kppan)        ; half sign "up"
  asig1 = asig*kpleft;
  asig2 = asig*kpright;
  ; To the chorus effect, through zak channels 1 and 2
  zawm asig1, 1
  zawm asig2, 2
endin

; live input per reverbero

instr 8	;live input
  asig1,asig2	ins
  zawm asig1, 1
  zawm asig2, 2
endin


; strumento senza invalue

instr 9	;String pad
; String-pad borrwoed from the piece "Dorian Gray",
; http://akozar.spymac.net/music/ Modified to fit my needs

  ihz  = p4
  idb  = p5/127 * 70    ; rescale MIDI velocity to 70db
  ipos = p6
  iamp = ampdb(idb)

; modified by dmorelli

;kpos invalue "pos1"
;kamp  invalue "amp1"
;kctrl = kamp*70
;kctrl =	ampdb(kctrl)
  ; Slow attack and release
  kctrl   linseg  0, p3/4, iamp, p3/2, 0  
  ; Slight chorus effect
  afund   oscil   kctrl, ihz, 1            ; audio oscillator
  acel1   oscil   kctrl, ihz - .1, 1       ; audio oscillator - flat
  acel2   oscil   kctrl, ihz + .1, 1       ; audio oscillator - sharp
  asig    =   afund + acel1 + acel2

  ; Cut-off high frequencies depending on midi-velocity
  ; (larger velocity implies more brighter sound)
  asig butterlp asig, (p5-60)*40+900
 
  ; Panning
  ippan =       ipos*1.570796325  ; half of PI (radians of 90o angle)
  ipleft        =       cos(ippan)        ; half sign "down"
  ipright       =       sin(ippan)        ; half sign "up"
  asig1 = asig*ipleft;
  asig2 = asig*ipright;
  ; To the chorus effect, through zak channels 1 and 2
  zawm asig1, 1
  zawm asig2, 2
endin

; ================================================================
; EFFECTS
; ================================================================


; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Chorus effect, borrowed from http://www.jlpublishing.com/Csound.htm
; I made some of its parameters accesible trhough score
instr 10	;Chorus
  ; Read input from zak
  a1     zar     1
  a2     zar     2
  idlyml=p4      ;delay in milliseconds
  k1             oscili          idlyml/p5, 1, 2
  ar1l           vdelay3 a1, idlyml/5+k1, 900    ;delayed sound 1
  ar1r           vdelay3 a2, idlyml/5+k1, 900    ;delayed sound 1
  k2             oscili          idlyml/p5, .995, 2
  ar2l           vdelay3 a1, idlyml/5+k2, 700    ;delayed sound 2
  ar2r           vdelay3 a2, idlyml/5+k2, 700    ;delayed sound 2
  k3             oscili          idlyml/p5, 1.05, 2
  ar3l           vdelay3 a1, idlyml/5+k3, 700    ;delayed sound 3
  ar3r           vdelay3 a2, idlyml/5+k3, 700    ;delayed sound 3
  k4             oscili          idlyml/p5, 1, 2
  ar4l           vdelay3 a1, idlyml/5+k4, 900    ;delayed sound 4
  ar4r           vdelay3 a2, idlyml/5+k4, 900    ;delayed sound 4
  aoutl          =               (a1+ar1l+ar2l+ar3l+ar4l)*.5
  aoutr          =               (a2+ar1r+ar2r+ar3r+ar4r)*.5

  ; To the output mixer
  zawm            aoutl, 5
  zawm            aoutr, 6
  ; and also to the reverb unit
  ga1 = ga1 + (aoutl+aoutr)*.5
endin

; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Reverb
; 8 delay line FDN reverb, with feedback matrix based upon 
; physical modeling scattering junction of 8 lossless waveguides
; of equal characteristic impedance. Based on Julius O. Smith III, 
; "A New Approach to Digital Reverberation using Closed Waveguide
; Networks," Proceedings of the International Computer Music 
; Conference 1985, p. 47-53 (also available as a seperate
; publication from CCRMA), as well as some more recent papers by
; Smith and others.
;
; Coded by Sean Costello, October 1999
instr 25	;Reverb
  ; Note: ga1 is the global input to the reverb.
  afilt1 init 0
  afilt2 init 0
  afilt3 init 0
  afilt4 init 0
  afilt5 init 0
  afilt6 init 0
  afilt7 init 0
  afilt8 init 0
  idel1 = (2473.000/sr)
  idel2 = (2767.000/sr)
  idel3 = (3217.000/sr)
  idel4 = (3557.000/sr)
  idel5 = (3907.000/sr)
  idel6 = (4127.000/sr)
  idel7 = (2143.000/sr)
  idel8 = (1933.000/sr)
  
  
  igain = p4      ; gain of reverb. Adjust empirically
                  ; for desired reverb time. .6 gives
                  ; a good small "live" room sound, .8
                  ; a small hall, .9 a large hall,
                  ; .99 an enormous stone cavern.
  
  ipitchmod = p5  ; amount of random pitch modulation
                  ; for the delay lines. 1 is the "normal"
                  ; amount, but this may be too high for
                  ; held pitches such as piano tones.
                  ; Adjust to taste.
  
  itone = p6      ; Cutoff frequency of lowpass filters
                  ; in feedback loops of delay lines,
                  ; in Hz. Lower cutoff frequencies results
                  ; in a sound with more high-frequency
                  ; damping.
  
  ; k1-k8 are used to add random pitch modulation to the
  ; delay lines. Helps eliminate metallic overtones
  ; in the reverb sound.
  k1      randi   .001, 3.1, .06
  k2      randi   .0011, 3.5, .9
  k3      randi   .0017, 1.11, .7
  k4      randi   .0006, 3.973, .3
  k5      randi   .001, 2.341, .63
  k6      randi   .0011, 1.897, .7
  k7      randi   .0017, 0.891, .9
  k8      randi   .0006, 3.221, .44
  ; apj is used to calculate "resultant junction pressure" for 
  ; the scattering junction of 8 lossless waveguides
  ; of equal characteristic impedance. If you wish to
  ; add more delay lines, simply add them to the following 
  ; equation, and replace the .25 by 2/N, where N is the 
  ; number of delay lines.
  apj = .25 * (afilt1 + afilt2 + afilt3 + afilt4 + afilt5 + afilt6 + afilt7 + afilt8)
  
  
  adum1   delayr  1
  adel1   deltapi idel1 + k1 * ipitchmod
          delayw  ga1 + apj - afilt1
  
  adum2   delayr  1
  adel2   deltapi idel2 + k2 * ipitchmod
          delayw  ga1 + apj - afilt2
  
  adum3   delayr  1
  adel3   deltapi idel3 + k3 * ipitchmod
          delayw  ga1 + apj - afilt3
  
  adum4   delayr  1
  adel4   deltapi idel4 + k4 * ipitchmod
          delayw  ga1 + apj - afilt4
  
  adum5   delayr  1
  adel5   deltapi idel5 + k5 * ipitchmod
          delayw  ga1 + apj - afilt5
  
  adum6   delayr  1
  adel6   deltapi idel6 + k6 * ipitchmod
          delayw  ga1 + apj - afilt6
  
  adum7   delayr  1
  adel7   deltapi idel7 + k7 * ipitchmod
          delayw  ga1 + apj - afilt7
  
  adum8   delayr  1
  adel8   deltapi idel8 + k8 * ipitchmod
          delayw  ga1 + apj - afilt8
  
  ; 1st order lowpass filters in feedback
  ; loops of delay lines.
  afilt1  tone    adel1 * igain, itone
  afilt2  tone    adel2 * igain, itone
  afilt3  tone    adel3 * igain, itone
  afilt4  tone    adel4 * igain, itone
  afilt5  tone    adel5 * igain, itone
  afilt6  tone    adel6 * igain, itone
  afilt7  tone    adel7 * igain, itone
  afilt8  tone    adel8 * igain, itone
  
  ; The outputs of the delay lines are summed
  ; and sent to the stereo outputs. This could
  ; easily be modified for a 4 or 8-channel 
  ; sound system.
  aout1 = (afilt1 + afilt3 + afilt5 + afilt7)
  aout2 = (afilt2 + afilt4 + afilt6 + afilt8)
  ;outs    aout1, aout2
  ; To the output mixer
  zawm aout1, 5
  zawm aout2, 6
  ga1 = 0
endin


; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Output mixer
; It applies a bass enhancement, compression and fadeout
; to the whole piece,
instr 30	;Mixer
  ; Read input from zak
  a1  zar 5
  a2  zar 6
  ; Bass enhancement
  al1 butterlp a1, 100
  al2 butterlp a2, 100
  a1 = al1*1.5 +a1
  a2 = al2*1.5 +a2 

  ; Global amplitude shape
  ; It applies a gain of p4 to the whole piece, and creates a
  ; fadeout the last p5 seconds
  kenv   linseg  p4, p3-p5, p4, p5, 0 
  a1=a1*kenv
  a2=a2*kenv 
  
  ; Compression
  a1 dam a1, 5000, 0.5, 1, 0.2, 0.1  
  a2 dam a2, 5000, 0.5, 1, 0.2, 0.1  
  
  outs a1, a2
  zacl 0, 10
endin