aboutsummaryrefslogtreecommitdiff
path: root/BUG4/instruments.udo
blob: e8f85d3845a64a54465ace5fd4ca89aaadc06470 (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
#ifndef UDO_INSTRUMENTS
#define UDO_INSTRUMENTS ##
/*
	Debugger - Unfixed Bugs : BUG #4

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


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


instr play_303
	iamp = 1.2 ;getparameter(p4, p5, 2)
	
	inote1 = p4
	inote2 = p5
	ifilter = p6

	ifrq1 = 440 * exp(log(2) * (ifilter - 69) / 12)	; filter start freq.
	kamp linseg 1, p3*0.8, 1, p3*0.2, 0
	kcps line cpsmidinn(inote1), p3, cpsmidinn(inote2)
	kffrq port 0, 60/150, ifrq1		; filter frequency
	a1 phasor kcps		; oscillator
	a1 = 1 - 2 * a1

	a1x butterbp a1, kffrq, kcps * 1.0			; filters
	a1x =  a1x * (2 + kffrq / kcps)	; correct amplitude
	a1 = a1x + a1 * 0.25 ; 0.5
	a1 butterlp a1, kffrq

	a1 = taninv(a1 * 4 * iamp)	; distortion ; 2.5

	keqf limit kffrq * 4, 10, sr * 0.48	; EQ frequency
	a1 pareq a1 * 0.4, keqf, 4.0, 1.0, 2
	a1 butterhp a1, 50
	a1 = a1 * kamp
	aL, aR pan2 a1, random(0.3, 0.7)
	if (p7 == 1 && random(0, 1) > 0.6) then
		bus_mix("delay2", aL, aR)
	endif
	bus_mix("master", aL, aR)
endin


/*
	Istvan Varga
*/
instr play_rim
	iamp = 1
	icps = 220
	acps expon icps, 0.0025, icps * 0.5
	acps = acps + icps
	iamp = 1
	a1a phasor acps, 0.0	
	a1b phasor acps, 0.5
	afmenv expon 1.0, 0.02, 0.5
	a1 = (a1a-a1b)*6.0*afmenv
	acps = acps*(1.0+a1)
	a0 oscil3 1.0, acps
	a1 unirand 2.0
	a1 tone a1-1.0, 2000
	a0 = a0 + a1*0.1
	aenv expon 1.0, 0.005, 0.5
	a0 limit 4.0*iamp*a0*aenv, -1.0, 1.0
	a0 table3 a0*4096.0, gifnSaw, 0, 0, 1
	kffrq expseg 2000, 0.07, 100, 1, 100
	a0x tone a0, 10000
	a0y = a0 - a0x
	a0x delay a0y, 0.0002
	a0 = a0 - a0x*4.0
	a0 pareq a0, kffrq, 0, 0.7071, 2
	a_ linseg 1, p3-0.1, 1, 0.025, 0, 1, 0
	a0 = a0*a_
	aL, aR pan2 a0*iamp, random(0.3, 0.8)

	bus_mix("delay1", aL, aR)
	bus_mix("master", aL, aR)
endin

instr play_blip
	a1 oscil 0.6, 4400
	kamp line 1, p3, 0
	a1 *= kamp

	bus_mix("delay2", a1, a1)
endin


instr play_clap
	aL noise 1, 0.3
	aR noise 1, 0.4
	aL butterbp aL, 1200, 700
	aR butterbp aR, 1200, 700
	aL taninv aL*7
	aR taninv aR*7
	
	kamp linseg 2, p3, 0
	aL *= kamp
	aR *= kamp
	bus_mix("delay2", aL, aR)
	bus_mix("master", aL, aR)
	
endin


instr play_kick	; 808 style kick
	iamp = 1
	xtratim 0.1
	krelease release
	ktune init -1.1
	kmul transeg 0.2, p3*0.5, -15, 0.01, p3*0.5, 0, 0
	kbend transeg 0.5, 1.2, -4, 0, 1, 0, 0
	asig gbuzz 0.5, 50*octave(ktune)*semitone(kbend), 20, 1, kmul, gifnCosine
	aenv transeg 1, p3-0.004, -6, 0
	gkpump = k(aenv)
	aatt linseg 0, 0.004, 1
	asig = asig*aenv*aatt
	aenv linseg 1, 0.07, 0
	acps expsega 400, 0.07, 0.001, 1, 0.001
	aimp oscili aenv, acps*octave(ktune*0.25)
	amix = ((asig*0.7)+(aimp*0.35))*2*iamp
	gkpump = min(rms(amix) * 7, 1)
	aout1 pareq amix, 100, 0.01, 0.6
	aout1 distort aout1, 0.25, (p4 == 1 && random(0, 1) > 0.6) ? gifnSaw : gifnSine
	aout1 pareq aout1, 100, 0.01, 0.6
	aout1 *= 3
	bus_mix("master", aout1, aout1)
endin


#end