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
|
#ifndef UDO_SCSS_MIXER_EFFECTS
#define UDO_SCSS_MIXER_EFFECTS ##
#include "/frequency_tools.udo"
#include "/wavetables.udo"
opcode _fxi_control, Sk, ii
ichannelindex, ieffectindex xin
SchanAppend = sprintf("_%d_%d", ichannelindex, ieffectindex)
kon = chnget:k(strcat("fxi_on", SchanAppend))
xout SchanAppend, kon
endop
opcode fxi_param, k, SS
SchanAppend, Sname xin
xout chnget:k(strcat(strcat("fxi_", Sname), SchanAppend))
endop
opcode fxi_param, i, SS
SchanAppend, Sname xin
xout chnget:i(strcat(strcat("fxi_", Sname), SchanAppend))
endop
gSeffectDefs = {{
{
"effects": [
{
"name": "Reverb",
"opcode": "fxi_reverb",
"parameters": [
{"name": "roomsize", "description": "Room size", "default": 0.3, "max": 1, "min": 0},
{"name": "hfdamp", "description": "High frequency damping", "default": 0.5, "max": 1, "min": 0}
]
},
{
"name": "Frequency shifter 1",
"opcode": "fxi_freqshift1",
"parameters": [
{"name": "shift", "description": "Shift frequency", "default": 0, "max": 2000, "min": -2000}
]
},
{
"name": "Frequency shifter 2",
"opcode": "fxi_freqshift2",
"parameters": [
{"name": "shift", "description": "Shift frequency", "default": 0, "max": 2000, "min": -2000}
]
},
{
"name": "Ring modulator",
"opcode": "fxi_ringmod",
"parameters": [
{"name": "freq", "description": "Frequency", "default": 440, "max": 10000, "min": 20}
]
},
{
"name": "Bit crusher",
"opcode": "fxi_bitcrush",
"parameters": [
{"name": "crush", "description": "Bits", "default": 8, "max": 64, "min": 2, "type": "int"}
]
},
{
"name": "Delay tuner",
"opcode": "fxi_delaytuner",
"parameters": [
{"name": "freq", "description": "Frequency", "default": 110, "max": 4000, "min": 50},
{"name": "feedback", "description": "Feedback", "default": 0.4, "max": 0.9, "min": 0}
]
},
{
"name": "Low pass filter",
"opcode": "fxi_lowpass",
"parameters": [
{"name": "freq", "description": "Frequency", "default": 10000, "max": 20000, "min": 20}
]
},
{
"name": "Highpass filter",
"opcode": "fxi_highpass",
"parameters": [
{"name": "freq", "description": "Frequency", "default": 1000, "max": 20000, "min": 20}
]
},
{
"name": "Simple chorus",
"opcode": "fxi_simplechorus",
"parameters": [
{"name": "rateL", "description": "Rate (Left)", "default": 0.01, "max": 0.1, "min": 0.001},
{"name": "rateR", "description": "Rate (Right)", "default": 0.01, "max": 0.1, "min": 0.001}
]
},
{
"name": "Simple delay",
"opcode": "fxi_simpledelay",
"parameters": [
{"name": "time", "description": "Delay time", "default": 1000, "max": 4000, "min": 1}
]
},
{
"name": "Waveshaping distortion",
"opcode": "fxi_distort",
"parameters": [
{"name": "distortion", "description": "Amount", "default": 0.1, "max": 2, "min": 0.001},
{"name": "wave", "description": "Wave shape", "options": [
{"name": "Sine", "value": 0},
{"name": "Square", "value": 1},
{"name": "Saw", "value": 2}
]}
]
}
]
}
}}
giJinsertDefs = jsonloads(gSeffectDefs)
opcode fxi_reverb, aa, aaii
aL, aR, ichannelindex, ieffectindex xin
SchanAppend, kon _fxi_control ichannelindex, ieffectindex
if (kon == 1) then
kroomsize = fxi_param(SchanAppend, "roomsize")
khfdamp = fxi_param(SchanAppend, "hfdamp")
aL, aR freeverb aL, aR, kroomsize, khfdamp
endif
xout aL, aR
endop
opcode fxi_simpledelay, aa, aaii ; TODO have beats delay option
aL, aR, ichannelindex, ieffectindex xin
SchanAppend, kon _fxi_control ichannelindex, ieffectindex
if (kon == 1) then
ktime = fxi_param(SchanAppend, "time")
aL vdelay aL, ktime, 4000
aR vdelay aR, ktime, 4000
endif
xout aL, aR
endop
opcode fxi_distort, aa, aaii
aL, aR, ichannelindex, ieffectindex xin
SchanAppend, kon _fxi_control ichannelindex, ieffectindex
if (kon == 1) then
kdist = fxi_param(SchanAppend, "distortion")
kwave = fxi_param(SchanAppend, "wave") ; TODO k to i... reinit??
aL distort aL, kdist, gifnSine ;ifn
aR distort aR, kdist, gifnSine ;ifn
endif
xout aL, aR
endop
opcode fxi_freqshift1, aa, aaii
aL, aR, ichannelindex, ieffectindex xin
SchanAppend, kon _fxi_control ichannelindex, ieffectindex
if (kon == 1) then
kshift = fxi_param(SchanAppend, "shift")
aL, aR freqshift1 aL, aR, kshift
endif
xout aL, aR
endop
opcode fxi_freqshift2, aa, aaii
aL, aR, ichannelindex, ieffectindex xin
SchanAppend, kon _fxi_control ichannelindex, ieffectindex
if (kon == 1) then
kshift = fxi_param(SchanAppend, "shift")
aL, aR freqshift2 aL, aR, kshift
endif
xout aL, aR
endop
opcode fxi_ringmod, aa, aaii
aL, aR, ichannelindex, ieffectindex xin
SchanAppend, kon _fxi_control ichannelindex, ieffectindex
if (kon == 1) then
kfreq = fxi_param(SchanAppend, "freq")
aL, aR ringmod1 aL, aR, kfreq
endif
xout aL, aR
endop
opcode fxi_bitcrush, aa, aaii
aL, aR, ichannelindex, ieffectindex xin
SchanAppend, kon _fxi_control ichannelindex, ieffectindex
if (kon == 1) then
kcrush = fxi_param(SchanAppend, "crush")
aL, aR bitcrush aL, aR, kcrush
endif
xout aL, aR
endop
opcode fxi_delaytuner, aa, aaii
aL, aR, ichannelindex, ieffectindex xin
SchanAppend, kon _fxi_control ichannelindex, ieffectindex
if (kon == 1) then
kfreq = fxi_param(SchanAppend, "freq")
kfeedback = fxi_param(SchanAppend, "feedback")
aL, aR delaytuner aL, aR, kfreq, kfeedback
endif
xout aL, aR
endop
opcode fxi_lowpass, aa, aaii
aL, aR, ichannelindex, ieffectindex xin
SchanAppend, kon _fxi_control ichannelindex, ieffectindex
if (kon == 1) then
kfreq = fxi_param(SchanAppend, "freq")
aL butterlp aL, kfreq
aR butterlp aR, kfreq
endif
xout aL, aR
endop
opcode fxi_highpass, aa, aaii
aL, aR, ichannelindex, ieffectindex xin
SchanAppend, kon _fxi_control ichannelindex, ieffectindex
if (kon == 1) then
kfreq = fxi_param(SchanAppend, "freq")
aL butterhp aL, kfreq
aR butterhp aR, kfreq
endif
xout aL, aR
endop
opcode fxi_simplechorus, aa, aaii
aL, aR, ichannelindex, ieffectindex xin
SchanAppend, kon _fxi_control ichannelindex, ieffectindex
if (kon == 1) then
krateL = fxi_param(SchanAppend, "rateL")
krateR = fxi_param(SchanAppend, "rateR")
aL, aR simplechorus aL, aR, krateL, krateR
endif
xout aL, aR
endop
#end
|