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
|
<CsoundSynthesizer>
<CsOptions>
-odac
-m0
</CsOptions>
<CsInstruments>
/*
Debugger - Unfixed Bugs : BUG #6
http://git.1bpm.net/csd-unfixedbugs1/about/
By Richard Knight 2021, 2023, 2024
http://1bpm.net
q@1bpm.net
*/
sr = 44100
ksmps = 64
nchnls = 2
0dbfs = 1.1
seed 0
#define NOFILEIO ## ; file IO with readfi not supported on all platforms: disables bid_loadfile
gkmastergain init 1 ; master gain
gkpump = 0 ; kick ducking control
gksection init 1
#include "wavetables.udo" ; general waveforms
#include "bussing.udo" ; global audio bussing
#include "bid.udo" ; Bug Infested Directive tools and parsing
#include "instruments.udo" ; sound generators
#include "txt_tools.udo" ; text tools
instr global_delay1
aL, aR bus_read "delay1"
ifreq1 = (gibid_tempo / 60) / 4
kfdbkL = abs(oscil(0.8, 1.67))
kfdbkR = abs(oscil(0.8, 1.67))
atimeL = abs(oscil(0.2, ifreq1)) + 0.3
atimeR = abs(oscil(0.2, ifreq1)) + 0.3
aLdlr delayr 1
aLdel deltapi atimeL
aLdel butterhp aLdel, 130
delayw aL + (aLdel * kfdbkL)
aRdlr delayr 1
aRdel deltapi atimeR
aRdel butterhp aRdel, 130
delayw aR + (aRdel * kfdbkR)
aLdel *= 1-gkpump
aRdel *= 1-gkpump
bus_mix("master", aLdel, aRdel)
endin
instr global_delay2
aL, aR bus_read "delay2"
aLdlr delayr 0.2
kdeltime = abs(oscil(0.02, 0.04)) + 0.01
aLdel deltapi kdeltime + 0.002
delayw aL + (aLdel * 0.7)
aRdlr delayr 0.2
aRdel deltapi kdeltime + 0.001
delayw aR + (aRdel * 0.7)
;aLdel *= 1-gkpump
;aRdel *= 1-gkpump
bus_mix("master", aLdel, aRdel)
endin
instr global_delay3
aL, aR bus_read "delay3"
ifreq1 = (gibid_tempo / 60) / 8
kfdbkL = abs(oscil(0.8, 1.63))
kfdbkR = abs(oscil(0.8, 1.67))
atimeL = abs(oscil(0.2, ifreq1)) + 0.01
atimeR = abs(oscil(0.2, ifreq1)) + 0.01
aLdlr delayr 1
aLdel deltapi atimeL
aLdel butterhp aLdel, 130
delayw aL + (aLdel * kfdbkL)
aRdlr delayr 1
aRdel deltapi atimeR
aRdel butterhp aRdel, 130
delayw aR + (aRdel * kfdbkR)
aLdel *= 1-gkpump
aRdel *= 1-gkpump
bus_mix("master", aLdel, aRdel)
endin
instr section_bus
isection = p4
ilen = p3
aL, aR bus_read "section_bus_send"
if (isection == 1) then
khpf linseg 0, ilen*0.5, 0, ilen*0.3, 100, ilen*0.1, 200, ilen*0.1, 900
knoiseamp linseg 0, ilen*0.8, 0.04, ilen*0.1, 0.1, ilen*0.1, 0.6
anL = noise(0.5, 0.2)
anR = noise(0.5, 0.3)
ifreq1 = cpsmidinn(table(0.5, gibid_chordfn, 1))
ifreq2 = cpsmidinn(table(0.1, gibid_chordfn, 1))
kfreq linseg ifreq1, ilen*0.8, ifreq1, ilen*0.2, ifreq2
aL += resony(anL, kfreq*4, 8, 24, 4) * 0.01 * knoiseamp
aR += resony(anR, kfreq*4, 8, 24, 4) * 0.01 * knoiseamp
aL butterhp aL, khpf
aR butterhp aR, khpf
elseif (isection == 3 || isection == 8 || isection == 12) then
anL = noise(0.5, 0.5)
anR = noise(0.5, 0.5)
knoiseamp linseg 0, ilen*0.7, 0.1, ilen*0.1, 0.2, ilen*0.2, 0.9
ifreq1 = cpsmidinn(table(0.3, gibid_chordfn, 1))
ifreq2 = cpsmidinn(table(0.6, gibid_chordfn, 1)) * 0.1
kfreq linseg ifreq1, ilen*0.8, ifreq1, ilen*0.2, ifreq2
aL += resony(anL, kfreq*4, 3, 24, 4) * 0.005 * knoiseamp
aR += resony(anR, kfreq*4, 3, 24, 4) * 0.005 * knoiseamp
bus_mix("delay1", aL*knoiseamp*0.3, aR*knoiseamp*0.3)
khpf expseg 1, ilen*0.4, 300, ilen*0.4, 600, ilen*0.1, 20, ilen*0.1, 20
aL butterhp aL, khpf
aR butterhp aR, khpf
endif
bus_set("section_bus_return", aL, aR)
endin
/*
Master audio output
*/
instr global_master
igain = 1
aL, aR bus_read "master"
awindex phasor giglitchsamples/sr
tablew aL, awindex*giglitchsamples, giglitchbufferL
tablew aR, awindex*giglitchsamples, giglitchbufferR
if (changed:k(gksection) == 1) then
schedulek("section_bus", 0, tab:k(gksection, gibid_sectionlengths) * gibid_beattime, gksection)
endif
bus_set("section_bus_send", aL, aR)
aL, aR bus_read "section_bus_return"
aL limit aL*0.5, -1, 1
aR limit aR*0.5, -1, 1
outs aL*gkmastergain*igain, aR*gkmastergain*igain
endin
/*
Parse BID file and run the sequencer
*/
instr parseandrun
tt_notify("Parsing events")
#include "bid_source.udo"
bid_loadtext(SBID)
tt_notify("Running sequencer")
schedule("sequencer", 0, 3600)
turnoff
endin
instr sequencer
isection = 1
schedule "bid_setcurrentchord", 0, 1, isection, 0
schedule "global_master", 0, p3
schedule "global_delay1", 0, p3
schedule "global_delay2", 0, p3
schedule "global_delay3", 0, p3
gksection bid_seq_all isection
endin
</CsInstruments>
<CsScore>
i"parseandrun" 0 1
</CsScore>
</CsoundSynthesizer>
|