forked from kunstmusik/csound-live-code
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemporal.csd
169 lines (123 loc) · 3.06 KB
/
temporal.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
;; test file for working with livecode.orc and
;; temporal recursion
<CsoundSynthesizer>
<CsOptions>
-o dac -d --port=10000 -m0
</CsOptions>
; ==============================================
<CsInstruments>
sr = 48000
ksmps = 16
nchnls = 2
0dbfs = 1
#include "livecode.orc"
instr TRe
ifreq = p4
iphs = p5
if(choose(0.25) == 1) then
schedule("Sub1", 0,
beats(rand(array(3,7,11))),
ifreq * xosc(phs(iphs, 16), array(0.5, 1, 1.5)),
ampdbfs(rand(array(-18, -21, -24))))
endif
schedule(p1, beats(rand(array(2.5, 1, 1.5))), p3, ifreq, iphs + 1)
endin
opcode alg0, k[], ik[]
// rand slice that is rand rotated
inum, kin[] xin
ilen = lenarray:i(kin)
inum = min:i(inum, ilen)
istart = int(random(0, ilen))
kvals[] init inum
indx = 0
while (indx < inum) do
kvals[indx] init i(kin, istart)
istart = (istart + 1) % inum
indx += 1
od
kout[] init inum
indx = 0
iread = int(random(0, inum))
while (indx < inum) do
ival = i(kvals, iread)
kout[indx] init ival
iread = (iread + 1) % inum
indx += 1
od
xout kout
endop
instr Melodic
iphs = p4
if(choose(.7) == 1) then
schedule("Sub4", 0,
beats(8),
in_scale(rand(array(1,2)), xosc(phs(iphs, 13), array(2,4,6,8, 6, 4))),
ampdbfs(-18))
endif
idur = beats(xosc(phs(iphs, 7), array(1, 1.5, 2)))
schedule(p1, idur, p3, iphs + 1)
endin
opcode play_chord,0,Siik[]i
Sinstr, idur, ibase, kvals[], iamp xin
turnoff
indx = 0
while (indx < lenarray:i(kvals)) do
schedule(Sinstr, 0, idur, cpsmidinn(ibase + i(kvals, indx)), ampdbfs(iamp))
indx += 1
od
endop
/*
play_chord("Sub1", beats(8), 72, array(0,2,4,5,7,9), -24)
play_chord("Sub1", beats(8), 67, array(0,2,4,5,7,9), -24)
play_chord("Sub1", beats(8), 62, array(0,1,3,5,6,8,10, 11), -28)
play_chord("Sub1", beats(8), 48, array(0,1,3,5,6,8,10, 11), -28)
*/
instr Mel2
;; put this here to make sure no perf code happens
turnoff
;; From the array note numbers, take a random
;; slice, and start at a random index for the
;; slice
/*knn[] = array(0,2,4,5,7,8,11,13)*/
/*knn[] = array(7, 0, 1, 8)*/
knn[] = array(2,5,7,1)
ilen = lenarray(knn)
inum = int(random(1, ilen + 1))
kvals[] alg0 inum, knn
indx = 0
istart = 0
while (indx < inum) do
inn = i(kvals, indx)
print inn
schedule("Sub1", istart,
beats(8),
cpsmidinn(72 + inn),
ampdbfs(-22))
if(choose(0.75) == 1) then
istart += beats(random(2, 4))
else
istart += beats(random(0.25, 1))
endif
indx += 1
od
schedule(p1, istart + beats(random(3,5)), p3)
endin
/*clear_instr("TRe")*/
/*schedule("Mel2", 0, 1)*/
/* PROJECT MAIN */
instr Start
seed(0)
set_scale("maj")
set_tempo(84)
schedule("TRe", 0, 1, 420, 0)
schedule("TRe", measures(8), 1, 120, 0)
schedule("TRe", measures(14), 1, 360, 0)
schedule("TRe", measures(20), 1, 800, 0)
;;schedule("Melodic", 0, 1, 0)
schedule("Mel2", 0, 1)
endin
schedule("Start", 0, 1)
/*clear_instr("TRe")*/
/*clear_instr("Melodic")*/
</CsInstruments>
</CsoundSynthesizer>