aboutsummaryrefslogtreecommitdiff
path: root/BUG9/instruments.udo
blob: 198d1961ab492b5f838805af956f9117a5532c56 (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
#ifndef UDO_INSTRUMENTS
#define UDO_INSTRUMENTS ##
/*
	Debugger - Unfixed Bugs : BUG #8

	Sound generators
	Names should correspond to those used in BID file, prepended with play_
*/


#include "wavetables.udo"
#include "bussing.udo"
#include "bid.udo"


instr play_bass
	iamp = bid_getparameter(p4, p5, 2)
	ifreq = cpsmidinn(table(1, gibid_chordfn, 0, 0, 1) - 48)
	k1 linseg 2.1, p3*0.2, 2, p3*0.8, 2
	k2 line 10, p3, 0
	kamp linseg 1, p3*0.1, 0.6, p3*0.9, 0
	aL foscil 1, ifreq, 4, k1, k2, gifnSine
	aR foscil 1, ifreq, 3.9, k1, k2, gifnSine
	aL pareq aL*1.3, 200, 0.3, 0.7
	aR pareq aR*1.3, 200, 0.3, 0.7
	bus_mix("master", aL*kamp*iamp, aR*kamp*iamp)
endin

instr play_mel1
	iamp = bid_getparameter(p4, p5, 2)
	ifreq = cpsmidinn(table(random(1, 4), gibid_chordfn, 0, 0, 1) + 12)
	kamp init 1
	aL wgbowedbar 1, ifreq, 0.5, 0.2, 0.995
	aR wgbowedbar 1, ifreq, 0.3, 0.5, 0.995
	bus_mix("master", aL*kamp*iamp, aR*kamp*iamp)
endin

instr play_mel2
	iamp = bid_getparameter(p4, p5, 2)
	ifreq = cpsmidinn(table(random(1, 4), gibid_chordfn, 0, 0, 1) - 12)
	k1 linseg 1.1, p3*0.2, 2, p3*0.8, 2
	k2 line 1, p3, 6
	kamp linseg 1, p3*0.1, 0.6, p3*0.9, 0
	aL foscil 1, ifreq, 4, k1, k2, gifnSine
	aR foscil 1, ifreq, 3.9, k1, k2, gifnSine
	aL pareq aL, 200, 0.3, 0.7
	aR pareq aR, 200, 0.3, 0.7
	bus_mix("master", aL*kamp*iamp, aR*kamp*iamp)
endin

/*
	clap
*/
gifnClap ftgen 0, 0, 1024, 7, 1, 128, 0, 1, 0.9, 128, 0, 1, 0.8, 128, 0, 1, 0.7, 128, 0, 1, 0.5, 256, 0.1, 256, 0
instr play_clap
	iamp = bid_getparameter(p4, p5, 2)
	p3 = 0.25
	kbetaL line 0.9, p3, 0.01
	kbetaR line 0.8, p3, 0.01
	aL noise 1, kbetaL
	aR noise 1, kbetaR
	kfreqL line 700+random(-100, 100), p3, 2500+random(-100, 100)
	kfreqR line 700+random(-100, 100), p3, 2500+random(-100, 100)

	apt oscil 1, line(50, p3, 2000)
	apt2 oscil 1, line(500, p3, 20)
	
	aL *= apt * apt2
	aR *= apt * apt2
	aL butterbp aL, kfreqL, 1000
	aR butterbp aR, kfreqR, 1000

	kndx phasor 1/p3
	kamp tab kndx, gifnClap, 1
	kamp *= linseg(1, p3*0.5, 0.2, p3*0.5, 0) * iamp * 8
	aL *= kamp
	aR *= kamp
	bus_mix("master", aL, aR)
/*
	p3 = 0.03
	kbt linseg 0.5, p3, -0.5
	aL noise 1, kbt
	aR noise 1, kbt+0.1
	kbpf linseg 1500, p3, 100
	kbnp linseg 800, p3, 100
	aL butterbp aL, kbpf, kbnp
	aR butterbp aR, kbpf, kbnp
	aL taninv aL*7
	aR taninv aR*7
	
	kamp linseg 1, p3*0.1, 0.3, p3*0.1, 0.9, p3*0.1, 0.3, p3*0.1, 0.8, p3*0.1, 0.2, p3*0.1, 0.7, p3*0.4, 0
	kamp2 = abs(oscil(0.5, 4)) + 0.5
	aL *= kamp * iamp
	aR *= kamp * iamp
	bus_mix("delay2", aL, aR)
	bus_mix("master", aL, aR)
	*/
endin


/*
	Closed lower frequency hi-hat
*/
instr play_hat1
	iamp = bid_getparameter(p4, p5, 2)
	idel = random(0.001, 0.02)
	xtratim idel
	p3 = random(0.01, 0.04)
	ifreq = 200
	aenv expsega .1, .0005, 1, p3 - .0005, .01
	asqr1 oscil 1, ifreq, gifnSaw, -1
	asqr2 oscil 1, ifreq*1.4471, gifnSquare, -1
	asqr3 oscil 1, ifreq*1.6170, gifnSaw, -1
	asqr4 oscil 1, ifreq*1.9265, gifnSaw, -1
	asqr5 oscil 1, ifreq*2.5028, gifnSaw, -1
	asqr6 oscil 1, ifreq*2.6637, gifnSaw, -1
	a808L sum asqr1, asqr2, asqr3, asqr4, asqr5, asqr6
	a808L butterhp a808L, 4270
	;a808L butterhp a808L, 4270
	aoutL = a808L * aenv * iamp
	aoutL delay aoutL, idel

	asqr1 oscil 1, ifreq, gifnSaw, -1
	asqr2 oscil 1, ifreq*1.3471, gifnSaw, -1
	asqr3 oscil 1, ifreq*1.6470, gifnSaw, -1
	asqr4 oscil 1, ifreq*1.8765, gifnSaw, -1
	asqr5 oscil 1, ifreq*2.4028, gifnSaw, -1
	asqr6 oscil 1, ifreq*2.5637, gifnSaw, -1
	a808R sum asqr1, asqr2, asqr3, asqr4, asqr5, asqr6
	a808R butterhp a808R, 4270
	;a808L butterhp a808L, 4270
	aoutR = a808R * aenv * iamp
	aoutR delay aoutR, idel
	bus_mix("master", aoutL, aoutR)
endin


instr play_hat2
	iamp = bid_getparameter(p4, p5, 2)
	idel1 = random(0.005, 0.02)
	idel2 = random(0.005, 0.02)
	xtratim(max:i(idel1, idel2))
	kfreq = abs(oscil(50, 10)) + 800
	aenv expsega .1, .0005, 1, p3 - .0005, .01
	asqr1 oscil 1, kfreq, gifnSquare, -1
	asqr2 oscil 1, kfreq*1.4471, gifnSquare, -1
	asqr3 oscil 1, kfreq*1.6170, gifnSquare, -1
	asqr4 oscil 1, kfreq*1.9265, gifnSquare, -1
	asqr5 oscil 1, kfreq*2.5028, gifnSquare, -1
	asqr6 oscil 1, kfreq*2.6637, gifnSquare, -1
	a808 sum asqr1, asqr2, asqr3, asqr4, asqr5, asqr6
	a808 butterhp a808, 3270
	a808 butterhp a808, 3270
	aout = a808 * aenv * iamp * 0.64
	aL delay aout, idel1
	aR delay aout, idel2
	bus_mix("master", aL, aR)
endin




/*
	Lightly distorted 808 style kick
*/
instr play_kick	
	iamp = bid_getparameter(p4, p5, 2)
	aout1 wgbowedbar 1, 60, 0.9, 0.1, 0.1
	aout1 distort aout1, 0.25, gifnSquare
	aout1 pareq aout1, 130, 0.3, 0.6
	aout1 pareq aout1, 9000, 5, 0.6
	aout1 *= 0.8
	bus_mix("master", aout1, aout1)
endin




#end