-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path240906.csd
267 lines (191 loc) · 7.24 KB
/
240906.csd
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
<CsoundSynthesizer>
<CsOptions>
-odac -m4 --port=10000
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1.0
seed 0
;; ================================================================================
;; Global Setup
;; ================================================================================
gkBPM init 120
;; Audio Bus for Reverb/Delay
gaRevL init 0
gaRevR init 0
gaDelL init 0
gaDelR init 0
;; Wavetable / Global Variables
giWave1 ftgen 1, 0, 8192, 10, 1, 0.7, 0.5, 0.2, 0.3, 0.2, 0.4
giMelodyCount init 0
giBeats[] fillarray 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0, 10.5, 12.0
giMelody init 0
giMelodies[] fillarray 12, 11, 7, 4, 7, 0, 2, 4, 0, 2, 4
giStringMelodyCount init 0
giStringBeats[] fillarray 0, 1, 2, 3, 10, 11, 12, 13, 14, 15, 16, 32, 36, 44, 45, 46, 47, 48, 52
giStringMelodies[] fillarray 7, 5, 4, 12, 11, 12, 14, 12, 11, 12, 16, 17, 5, 4, 5, 4, 5, 4, -3
;; Startup Instrument
schedule "reverb", 0, -1
schedule "delay", 0, -1
schedule "schedule", 0, 0.1, 0
;; ================================================================================
;; Scheduler
;; ================================================================================
instr schedule
ibeat = p4
ibeatDur = 60/i(gkBPM)
;; ================================================================================
;; main theme
;; ================================================================================
if ibeat % 16 == giBeats[giMelodyCount % lenarray(giBeats)] then
giMelody = giMelodies[giMelodyCount % lenarray(giBeats)]
giMelodyCount += 1
endif
ipan = rnd(1) < 0.5 ? 0.5 : rnd(1)
schedule "melody_synth", 0, 0.06, cpsmidinn(giMelody + 70), ipan
schedule "melody_synth", 0, 0.06, cpsmidinn(58 + 7), ipan
schedule "melody_synth", 0, 0.06, cpsmidinn(58 + (int(ibeat / 8) % 2 == 0 ? 5 : 4)), ipan
schedule "melody_synth", 0, 0.06, cpsmidinn(58), ipan
;; ================================================================================
;; string melody
;; ================================================================================
;; if ibeat % 64 == giStringBeats[giStringMelodyCount] then
;; istringDur = (giStringMelodyCount == (lenarray(giStringBeats) - 1) ? 60 : giStringBeats[giStringMelodyCount + 1]) - giStringBeats[giStringMelodyCount]
;; schedule "strings", 0, istringDur*ibeatDur, cpsmidinn(giStringMelodies[giStringMelodyCount] + 70)
;; giStringMelodyCount = (giStringMelodyCount + 1) % lenarray(giStringBeats)
;; endif
if ibeat % 8.0 == 0 then
;; ================================================================================
;; bass
;; ================================================================================
ibassNote[] fillarray 0, -3, -7, -3
ibass = ibassNote[ int(ibeat / 16) % lenarray(ibassNote) ]
schedule "bass", 0, 1.5, cpsmidinn(ibass + 46)
schedule "bass", ibeatDur*3.0, 0.25, cpsmidinn(ibass + 46)
schedule "bass", ibeatDur*4.0, 2, cpsmidinn(ibass + 46)
;; ================================================================================
;; fm-piano
;; ================================================================================
;; schedule "fm_piano", 0, 2, cpsmidinn(ibass+58)
;; schedule "fm_piano", 0, 2, cpsmidinn(58 + 7)
;; inotes[] fillarray 11, 14, 17, 19
;; inoteIndx = int(random(0, lenarray(inotes)))
;; idel = int(random(1,4))
;; schedule "fm_piano", ibeatDur * idel , 2, cpsmidinn(58 + inotes[inoteIndx])
;; inoteIndx = (inoteIndx + int(random(1, lenarray(inotes)-1))) % lenarray(inotes)
;; idel += int(random(0,4))
;; schedule "fm_piano", ibeatDur * idel, 2, cpsmidinn(58 + inotes[inoteIndx])
;; inoteIndx = (inoteIndx + int(random(1, lenarray(inotes)-1))) % lenarray(inotes)
;; idel += int(random(0,4))
;; schedule "fm_piano", ibeatDur * idel, 2, cpsmidinn(58 + inotes[inoteIndx])
endif
;; ================================================================================
;; pad
;; ================================================================================
if ibeat % 8 == 0 then
schedule "pad", .0, 8, cpsmidinn(58)
inotes[] fillarray 4, 5, 7, 11
schedule "pad", .0, 8, cpsmidinn(inotes[int(random(0, lenarray(inotes)))] + 58)
inotes[] fillarray 5, 7, 11, 16, 17, 19
schedule "pad", .0, 8, cpsmidinn(inotes[int(random(0, lenarray(inotes)))] + 70)
endif
;; ================================================================================
;; kick
;; ================================================================================
if ibeat % 4 == 0 then
schedule "kick", 0, 0.1
endif
;; ================================================================================
;; sine noise
;; ================================================================================
if ibeat % 16 == 0 then
schedule "sine", ibeatDur*.75, 0.2, 9000
endif
;; ================================================================================
;; recursive call schedule
;; ================================================================================
schedule "schedule", ibeatDur*.25, 0.1, ibeat+.25
endin
;; ================================================================================
;; Instruments
;; ================================================================================
instr melody_synth
aenv linseg .1, p3*.9, .1, p3*.1, .0
ifreq = p4
asig foscil aenv*0.8, ifreq, 1, 1, linseg:k(1, p3*.9,1, p3*.1, 0.2) * 1.3
al, ar pan2 asig, p5
outs al, ar
gaRevL += al *.3
gaRevR += ar *.3
gaDelL += al *.3
gaDelR += ar *.3
endin
instr kick
kfreq expon 280, p3, 20
asig oscil line:a(0.3, p3, 0), kfreq
outs asig, asig
endin
instr sine
aenv linseg .1, p3*.9,.1, p3*.1, 0
asig oscil aenv*.4, p4
outs asig, asig
gaRevL += asig*.1
gaRevR += asig*.1
endin
instr fm_piano
kenv linseg .07, p3, .0
kindx line 1, p3, 0
al foscil kenv, p4, 1, 1, 1
ar foscil kenv, p4+2, 1, 1, 1
outs al, ar
gaRevL += al*.2
gaRevR += ar*.2
gaDelL += al*.2
gaDelR += ar*.2
endin
instr bass
kfreq linseg p4+100, p3*.04, p4, p3*.8, p4
asig foscil line:k(0.1, p3, 0)*1.2, kfreq, 1, 0.5, oscil:k(0.5, 1.3)+0.7
outs asig, asig
endin
instr pad
kenv linseg .0, p3*.2, 1, p3*.6, 1, p3*.2, .0
al = reson(noise(0.007*kenv,0.0), p4, 0.8) * 0.007
ar = reson(noise(0.007*kenv,0.0), p4+2, 0.8) * 0.007
outs al,ar
gaRevL += al*.3
gaRevR += ar*.3
endin
instr strings
aenv linseg .0, p3*.05, .1, p3*.75, .1, p3*.2, .0
aenv *= .4
al oscil aenv, p4, giWave1
ar oscil aenv, p4+.1, giWave1
icutoff = 2600
outs moogladder(al, icutoff, 0.2), moogladder(ar, icutoff, 0.2)
gaRevL += al*.4
gaRevR += ar*.4
gaDelL += al*.3
gaDelR += ar*.3
endin
;; ================================================================================
;; Effect
;; ================================================================================
instr reverb
al, ar reverbsc gaRevL, gaRevR, .9, 12000
outs al, ar
clear gaRevL, gaRevR
endin
instr delay
al vdelay gaDelL, 60/gkBPM * (1000/2), 4000
ar vdelay gaDelR, 60/gkBPM * (1000/3), 4000
outs al, ar
gaDelL = al * .3
gaDelR = ar * .3
endin
</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>