-
Notifications
You must be signed in to change notification settings - Fork 3
/
sfx.h
499 lines (499 loc) · 45.1 KB
/
sfx.h
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
/* Generated with shader-compressor by NR4/Team210. */
#ifndef SFX_H
#define SFX_H
const char * sfx_frag =
"#version 130\n"
"#define PI radians(180.)\n"
"float clip(float a) { return clamp(a,-1.,1.); }\n"
"float theta(float x) { return smoothstep(0.,1e-3,clamp(x,0.,1e-3)); }\n"
"float _sin(float a) { return sin(2. * PI * mod(a,1.)); }\n"
"float _sin_(float a, float p) { return sin(2. * PI * mod(a,1.) + p); }\n"
"float _sq_(float a,float pwm) { return sign(2.*fract(a) - 1. + pwm); }\n"
"float _psq_(float a, float pwm) { return clip(50.*(_sin(a) - pwm)); } \n"
"float _tri(float a) { return (4.*abs(fract(a)-.5) - 1.); }\n"
"float freqC1(float note){ return 32.7 * pow(2., note/12.); }\n"
"float minus1hochN(int n) { return (1. - 2.*float(n % 2)); }\n"
"float minus1hochNminus1halbe(int n) { return sin(.5*PI*float(n)); }\n"
"float pseudorandom(float x) { return fract(sin(dot(vec2(x),vec2(12.9898,78.233))) * 43758.5453); }\n"
"float fhelp(float x) { return 1. + .333*x; } // 1. + .33333*x + .1*x*x + .02381*x*x*x + .00463*x*x*x*x;\n"
"\n"
"#define pat4(a,b,c,d,x) mod(x,1.)<.25 ? a : mod(x,1.)<.5 ? b : mod(x,1.) < .75 ? c : d\n"
"\n"
"#define NTIME 20\n"
"const float pos_B[20] = float[20](0.,2.,8.,10.,11.,12.,31.,34.,40.,42.,46.,50.,51.,52.,64.,65.,70.,71.,72.,95.);\n"
"const float pos_t[20] = float[20](0.,4.705882,18.552036,22.996481,25.139338,27.208303,65.208303,71.109943,82.722846,86.722846,94.998708,103.134301,105.134301,107.069785,129.569785,131.505269,141.341334,143.276818,145.151818,186.97);\n"
"const float pos_BPS[19] = float[19](.425,.4333,.45,.4667,.4833,.5,.5083,.5167,.5,.4833,.4917,.5,.5167,.5333,.5167,.5083,.5167,.5333,.55);\n"
"const float pos_SPB[19] = float[19](2.3529,2.3079,2.2222,2.1427,2.0691,2.,1.9673,1.9354,2.,2.0691,2.0338,2.,1.9354,1.8751,1.9354,1.9673,1.9354,1.8751,1.8182);\n"
"float BPS, SPB, BT;\n"
"\n"
"const float Fsample = 44100.; // CAUTION: THIS SHOULD BE 44100. FOR NR4.\n"
"const float Tsample = 1./Fsample;\n"
"\n"
"const float filterthreshold = 1e-3;\n"
"\n"
"//TEXCODE\n"
"\n"
"float s_atan(float a) { return 2./PI * atan(a); }\n"
"float squarey(float a, float edge) { return abs(a) < edge ? a : floor(4.*a+.5)*.25; } \n"
"\n"
"float doubleslope(float t, float a, float d, float s)\n"
"{\n"
" return smoothstep(-.00001,a,t) - (1.-s) * smoothstep(0.,d,t-a);\n"
"}\n"
"\n"
"float drop_phase(float time, float t1, float f0, float f1)\n"
"{\n"
" float t = min(time, t1);\n"
" float phi = f0*t + .5*(f1-f0)/t1*t*t;\n"
"\n"
" if(time > t1)\n"
" {\n"
" phi += f1 * (time - t1);\n"
" }\n"
" return phi;\n"
"}\n"
"\n"
"float lpnoise(float t, float fq)\n"
"{\n"
" t *= fq;\n"
" float tt = fract(t);\n"
" float tn = t - tt;\n"
" return mix(pseudorandom(floor(tn) / fq), pseudorandom(floor(tn + 1.0) / fq), smoothstep(0.0, 1.0, tt));\n"
"}\n"
"\n"
"float reverb_phase(float t, float amt)\n"
"{\n"
" float r = lpnoise(t, 100.0) + 0.2*lpnoise(t, 550.0) + 0.1*lpnoise(t, 1050.0)*exp(-5.*t);\n"
" return amt * r;\n"
"}\n"
"\n"
"float env_AHDSR(float x, float L, float A, float H, float D, float S, float R)\n"
"{\n"
" return (x<A ? x/A : x<A+H ? 1 : x<A+H+D ? (1. - (1.-S)*(x-H-A)/D) : x<=L-R ? S : x<=L ? S*(L-x)/R : 0.);\n"
"}\n"
"\n"
"float waveshape(float s, float amt, float A, float B, float C, float D, float E)\n"
"{\n"
" float w;\n"
" float m = sign(s);\n"
" s = abs(s);\n"
"\n"
" if(s<A) w = B * smoothstep(0.,A,s);\n"
" else if(s<C) w = C + (B-C) * smoothstep(C,A,s);\n"
" else if(s<=D) w = s;\n"
" else if(s<=1.)\n"
" {\n"
" float _s = (s-D)/(1.-D);\n"
" w = D + (E-D) * (1.5*_s*(1.-.33*_s*_s));\n"
" }\n"
" else return 1.;\n"
" \n"
" return m*mix(s,w,amt);\n"
"}\n"
"\n"
"float sinshape(float x, float amt, float parts)\n"
"{\n"
" return (1.-amt) * x + amt * sign(x) * 0.5 * (1. - cos(parts*PI*x));\n"
"}\n"
"\n"
"float comp_SAW(int N, float inv_N, float PW) {return inv_N * (1. - _sin(float(N)*PW));}\n"
"float comp_TRI(int N, float inv_N, float PW) {return N % 2 == 0 ? .1 * inv_N * _sin(float(N)*PW) : inv_N * inv_N * (1. - _sin(float(N)*PW));}\n"
"float comp_SQU(int N, float inv_N, float PW) {return inv_N * (minus1hochN(N) * _sin(.5*float(N)*PW + .25) - 1.);}\n"
"float comp_HAE(int N, float inv_N, float PW) {return N % 2 == 0 ? 0. : inv_N * (1. - minus1hochNminus1halbe(N))*_sin(PW);}\n"
"\n"
"float MADD(float t, float f, float p0, int NMAX, int NINC, float MIX, float CO, float NDECAY, float RES, float RES_Q, float DET, float PW, int keyF)\n"
"{\n"
" float ret = 0.;\n"
" float INR = keyF==1 ? 1./CO : f/CO;\n"
" float IRESQ = keyF==1 ? 1./RES_Q : 1./(RES_Q*f);\n"
" \n"
" float p = f*t;\n"
" float float_N, inv_N, comp_mix, filter_N;\n"
" for(int N=1; N<=NMAX; N+=NINC)\n"
" {\n"
" float_N = float(N);\n"
" inv_N = 1./float_N;\n"
" comp_mix = MIX < 0. ? (MIX+1.) * comp_TRI(N,inv_N,PW) - MIX * comp_SAW(N,inv_N,PW)\n"
" : MIX < 1. ? (1.-MIX) * comp_TRI(N,inv_N,PW) + MIX * comp_SQU(N,inv_N,PW)\n"
" : (MIX-1.) * comp_HAE(N,inv_N,PW) + (2.-MIX) * comp_SQU(N,inv_N,PW);\n"
"\n"
" if(abs(comp_mix) < 1e-6) continue;\n"
"\n"
" filter_N = pow(1. + pow(float_N*INR,NDECAY),-.5) + RES * exp(-pow((float_N*f-CO)*IRESQ,2.));\n"
" \n"
" ret += comp_mix * filter_N * (_sin_(float_N * p, p0) + _sin_(float_N * p * (1.+DET), p0));\n"
" }\n"
" return s_atan(ret);\n"
"}\n"
"\n"
"float QFM_FB(float PH, float FB) // my guessing of feedback coefficients, FB>0 'saw', FB<0 'sq'\n"
"{\n"
" if(FB > 0.) return abs(FB) * .8*_sin(PH + .35*_sin(PH));\n"
" else return abs(FB) * _sin(PH + .5*PI);\n"
"}\n"
"\n"
"float QFM(float t, float f, float phase, float LV1, float LV2, float LV3, float LV4, float FR1, float FR2, float FR3, float FR4, float FB1, float FB2, float FB3, float FB4, float ALGO)\n"
"{\n"
" int iALGO = int(ALGO);\n"
" float PH1 = FR1 * f * t + phase;\n"
" float PH2 = FR2 * f * t + phase;\n"
" float PH3 = FR3 * f * t + phase;\n"
" float PH4 = FR4 * f * t + phase;\n"
" \n"
" float LINK41 = 0., LINK42 = 0., LINK43 = 0., LINK32 = 0., LINK31 = 0., LINK21 = 0.; \n"
" if(iALGO == 1) {LINK43 = 1.; LINK32 = 1.; LINK21 = 1.;}\n"
" else if(iALGO == 2) {LINK42 = 1.; LINK32 = 1.; LINK21 = 1.;} \n"
" else if(iALGO == 3) {LINK41 = 1.; LINK32 = 1.; LINK21 = 1.;}\n"
" else if(iALGO == 4) {LINK42 = 1.; LINK43 = 1.; LINK31 = 1.; LINK21 = 1.;}\n"
" else if(iALGO == 5) {LINK41 = 1.; LINK31 = 1.; LINK21 = 1.;}\n"
" else if(iALGO == 6) {LINK43 = 1.; LINK32 = 1.;}\n"
" else if(iALGO == 7) {LINK43 = 1.; LINK32 = 1.; LINK31 = 1.;}\n"
" else if(iALGO == 8) {LINK21 = 1.; LINK43 = 1.;}\n"
" else if(iALGO == 9) {LINK43 = 1.; LINK42 = 1.; LINK41 = 1.;}\n"
" else if(iALGO == 10) {LINK43 = 1.; LINK42 = 1.;}\n"
" else if(iALGO == 11) {LINK43 = 1.;}\n"
"\n"
" float OP4 = LV4 * _sin(PH4 + QFM_FB(PH4, FB4));\n"
" float OP3 = LV3 * _sin(PH3 + QFM_FB(PH3, FB3) + LINK43*OP4);\n"
" float OP2 = LV2 * _sin(PH2 + QFM_FB(PH2, FB2) + LINK42*OP4 + LINK32*OP3);\n"
" float OP1 = LV1 * _sin(PH1 + QFM_FB(PH1, FB1) + LINK41*OP4 + LINK31*OP3 + LINK32*OP2);\n"
" \n"
" float sum = OP1;\n"
" if(LINK21 > 0.) sum += OP2;\n"
" if(LINK31 + LINK32 > 0.) sum += OP3;\n"
" if(LINK41 + LINK42 + LINK43 > 0.) sum += OP4;\n"
" \n"
" return s_atan(sum);\n"
"}\n"
"\n"
"float protokick(float t, float f_start, float f_end, float fdecay, float hold, float decay, float drive, float detune, float rev_amount, float rev_hold, float rev_decay, float rev_drive)\n"
"{\n"
" float phi = drop_phase(t, fdecay, f_start, f_end);\n"
" float rev_phi = phi + reverb_phase(t, 1.);\n"
" return clamp(drive*.5*(_sin(phi)+_sin((1.-detune)*phi)),-1.,1.) * exp(-max(t-hold, 0.)/decay)\n"
" + rev_amount*clamp(rev_drive*.5*(_sin(rev_phi)+_sin((1.-detune)*rev_phi)),-1.,1.) * exp(-max(t-rev_hold, 0.)/rev_decay);\n"
"} \n"
"\n"
"uniform float iBlockOffset;\n"
"uniform float iSampleRate;\n"
"uniform float iVolume;\n"
"uniform int iTexSize;\n"
"uniform sampler2D iSequence;\n"
"uniform float iSequenceWidth;\n"
"\n"
"// Read short value from texture at index off\n"
"float rshort(float off)\n"
"{\n"
" float hilo = mod(off, 2.);\n"
" off *= .5;\n"
" vec2 ind = (vec2(mod(off, iSequenceWidth), floor(off/iSequenceWidth))+.05)/iSequenceWidth;\n"
" vec4 block = texture(iSequence, ind);\n"
" vec2 data = mix(block.rg, block.ba, hilo);\n"
" return round(dot(vec2(255., 65280.), data));\n"
"}\n"
"\n"
"// Read float value from texture at index off\n"
"float rfloat(int off)\n"
"{\n"
" float d = rshort(float(off));\n"
" float sign = floor(d/32768.),\n"
" exponent = floor(d/1024.-sign*32.),\n"
" significand = d-sign*32768.-exponent*1024.;\n"
"\n"
" if(exponent == 0.)\n"
" return mix(1., -1., sign) * 5.960464477539063e-08 * significand;\n"
" return mix(1., -1., sign) * (1. + significand * 9.765625e-4) * pow(2.,exponent-15.);\n"
"}\n"
"\n"
"#define NTRK 17\n"
"#define NMOD 220\n"
"#define NPTN 41\n"
"#define NNOT 1979\n"
"#define NDRM 40\n"
"\n"
"int trk_sep(int index) {return int(rfloat(index));}\n"
"int trk_syn(int index) {return int(rfloat(index+1+1*NTRK));}\n"
"float trk_norm(int index) {return rfloat(index+1+2*NTRK);}\n"
"float trk_rel(int index) {return rfloat(index+1+3*NTRK);}\n"
"float trk_pre(int index) {return rfloat(index+1+4*NTRK);}\n"
"float trk_slide(int index) {return rfloat(index+1+5*NTRK);} // idea for future: change to individual note_slide_time\n"
"float mod_on(int index) {return rfloat(index+1+6*NTRK);}\n"
"float mod_off(int index) {return rfloat(index+1+6*NTRK+1*NMOD);}\n"
"int mod_ptn(int index) {return int(rfloat(index+1+6*NTRK+2*NMOD));}\n"
"float mod_transp(int index) {return rfloat(index+1+6*NTRK+3*NMOD);}\n"
"int ptn_sep(int index) {return int(rfloat(index+1+6*NTRK+4*NMOD));}\n"
"float note_on(int index) {return rfloat(index+2+6*NTRK+4*NMOD+NPTN);}\n"
"float note_off(int index) {return rfloat(index+2+6*NTRK+4*NMOD+NPTN+1*NNOT);}\n"
"float note_pitch(int index) {return rfloat(index+2+6*NTRK+4*NMOD+NPTN+2*NNOT);}\n"
"float note_pan(int index) {return rfloat(index+2+6*NTRK+4*NMOD+NPTN+3*NNOT);}\n"
"float note_vel(int index) {return rfloat(index+2+6*NTRK+4*NMOD+NPTN+4*NNOT);}\n"
"float note_slide(int index) {return rfloat(index+2+6*NTRK+4*NMOD+NPTN+5*NNOT);}\n"
"float note_aux(int index) {return rfloat(index+2+6*NTRK+4*NMOD+NPTN+6*NNOT);}\n"
"float drum_rel(int index) {return rfloat(index+2+6*NTRK+4*NMOD+NPTN+7*NNOT);}\n"
"\n"
"vec2 mainSynth(float time)\n"
"{\n"
" float sL = 0.;\n"
" float sR = 0.;\n"
" float dL = 0.;\n"
" float dR = 0.;\n"
"\n"
" \n"
" int _it;\n"
" for(_it = 0; _it < NTIME - 2 && pos_t[_it + 1] < time; _it++);\n"
" BPS = pos_BPS[_it];\n"
" SPB = pos_SPB[_it];\n"
" BT = pos_B[_it] + (time - pos_t[_it]) * BPS;\n"
" \n"
" float time2 = time - .0002;\n"
" float sidechain = 1.;\n"
"\n"
" float amaysynL, amaysynR, amaydrumL, amaydrumR, B, Bon, Boff, Bprog, Bproc, L, tL, _t, _t2, vel, rel, pre, f, amtL, amtR, env, slide, aux;\n"
" int tsep0, tsep1, _modU, _modL, ptn, psep0, psep1, _noteU, _noteL, syn, drum;\n"
"\n"
" for(int trk = 0; trk < NTRK; trk++)\n"
" {\n"
" tsep0 = trk_sep(trk);\n"
" tsep1 = trk_sep(trk + 1);\n"
"\n"
" syn = trk_syn(trk);\n"
" rel = trk_rel(trk);\n"
" pre = trk_pre(trk);\n"
" \n"
" for(_modU = tsep0; (_modU < tsep1 - 1) && (BT > mod_on(_modU + 1) - pre); _modU++); \n"
" for(_modL = tsep0; (_modL < tsep1 - 1) && (BT >= mod_off(_modL) + rel); _modL++);\n"
"\n"
" for(int _mod = _modL; _mod <= _modU; _mod++)\n"
" {\n"
" B = BT - mod_on(_mod);\n"
"\n"
" ptn = mod_ptn(_mod);\n"
" psep0 = ptn_sep(ptn);\n"
" psep1 = ptn_sep(ptn + 1);\n"
" \n"
" for(_noteU = psep0; (_noteU < psep1 - 1) && (B > note_on(_noteU + 1) - pre); _noteU++);\n"
" for(_noteL = psep0; (_noteL < psep1 - 1) && (B >= note_off(_noteL) + rel); _noteL++);\n"
"\n"
" for(int _note = _noteL; _note <= _noteU; _note++)\n"
" {\n"
" if(syn == 119)\n"
" {\n"
" drum = int(note_pitch(_note));\n"
" rel = drum_rel(drum);\n"
" }\n"
"\n"
" amaysynL = 0.;\n"
" amaysynR = 0.;\n"
" amaydrumL = 0.;\n"
" amaydrumR = 0.;\n"
"\n"
" Bon = note_on(_note) - pre;\n"
" Boff = note_off(_note) + rel;\n"
" L = Boff - Bon;\n"
" tL = L * SPB;\n"
" Bprog = B - Bon;\n"
" Bproc = Bprog / L;\n"
" _t = Bprog * SPB;\n"
" _t2 = _t - .0002;\n"
" vel = note_vel(_note);\n"
" amtL = clamp(1. - note_pan(_note), 0., 1.);\n"
" amtR = clamp(1. + note_pan(_note), 0., 1.);\n"
" slide = note_slide(_note);\n"
" aux = note_aux(_note);\n"
"\n"
" if(syn == 119)\n"
" {\n"
" env = trk_norm(trk) * theta(Bprog) * theta(L - Bprog);\n"
" if(drum == 0) { sidechain = min(sidechain, 1. - vel * (clamp(1e4 * Bprog,0.,1.) - pow(Bprog/(L-rel),8.))); }\n"
" else if(drum == 1){\n"
" amaydrumL = vel*.2*fract(sin(_t*100.*.9)*50000.*.9)*doubleslope(_t,.03,.1,.1);\n"
" amaydrumR = vel*.2*fract(sin(_t2*100.*.9)*50000.*.9)*doubleslope(_t2,.03,.1,.1);\n"
" }\n"
" else if(drum == 2){\n"
" amaydrumL = vel*(lpnoise(_t,10000.)*smoothstep(0.,.01,_t)*(1.-(1.-.13)*smoothstep(0.,.12,_t-.01))-.3*(1.00*lpnoise((_t-0.00),10000.)*smoothstep(0.,.01,(_t-0.00))*(1.-(1.-.13)*smoothstep(0.,.12,(_t-0.00)-.01))+6.10e-01*lpnoise((_t-1.20e-03),10000.)*smoothstep(0.,.01,(_t-1.20e-03))*(1.-(1.-.13)*smoothstep(0.,.12,(_t-1.20e-03)-.01))+3.72e-01*lpnoise((_t-2.40e-03),10000.)*smoothstep(0.,.01,(_t-2.40e-03))*(1.-(1.-.13)*smoothstep(0.,.12,(_t-2.40e-03)-.01))));\n"
" amaydrumR = vel*(lpnoise(_t,10000.)*smoothstep(0.,.01,_t)*(1.-(1.-.13)*smoothstep(0.,.12,_t-.01))-.3*(1.00*lpnoise((_t-0.00),10000.)*smoothstep(0.,.01,(_t-0.00))*(1.-(1.-.13)*smoothstep(0.,.12,(_t-0.00)-.01))+6.10e-01*lpnoise((_t-1.20e-03),10000.)*smoothstep(0.,.01,(_t-1.20e-03))*(1.-(1.-.13)*smoothstep(0.,.12,(_t-1.20e-03)-.01))+3.72e-01*lpnoise((_t-2.40e-03),10000.)*smoothstep(0.,.01,(_t-2.40e-03))*(1.-(1.-.13)*smoothstep(0.,.12,(_t-2.40e-03)-.01))));\n"
" }\n"
" else if(drum == 3){\n"
" amaydrumL = vel*fract(sin(_t*100.*1.)*50000.*1.)*doubleslope(_t,0.,.01,.1)*theta(Bprog)*exp(-10.*Bprog);\n"
" amaydrumR = vel*fract(sin(_t2*100.*1.)*50000.*1.)*doubleslope(_t2,0.,.01,.1)*theta(Bprog)*exp(-10.*Bprog);\n"
" }\n"
" else if(drum == 4){\n"
" amaydrumL = vel*fract(sin(_t*100.*.5)*50000.*.5)*doubleslope(_t,0.,.03,.1)*theta(Bprog)*exp(-13.*Bprog);\n"
" amaydrumR = vel*fract(sin(_t2*100.*.5)*50000.*.5)*doubleslope(_t2,0.,.03,.1)*theta(Bprog)*exp(-13.*Bprog);\n"
" }\n"
" else if(drum == 5){\n"
" amaydrumL = vel*.25*sinshape(fract(sin(_t*100.*30.)*50000.*20.)*doubleslope(_t,0.,.1,.1)+lpnoise(_t + 0.,6000.),1.,5.)*theta(Bprog)*exp(-2.*Bprog);\n"
" amaydrumR = vel*.25*sinshape(fract(sin(_t2*100.*30.)*50000.*20.)*doubleslope(_t2,0.,.1,.1)+lpnoise(_t2 + 0.,6000.),1.,5.)*theta(Bprog)*exp(-2.*Bprog);\n"
" }\n"
" else if(drum == 6){\n"
" amaydrumL = vel*(clamp(1.95*_tri(drop_phase(_t,.1,140.,114.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.24))+.07*clamp(.25*_tri(drop_phase(_t,.1,140.,114.)+.07*lpnoise(_t,4577.)),-1.,1.)*exp(-11.43*_t)+0.*lpnoise(_t,13098.)*(1.-smoothstep(0.,.32,_t-.76))+.75*lpnoise(_t,7668.)*exp(-_t*5.99)+.96*lpnoise(_t,1984.)*exp(-_t*20.65))*smoothstep(0.,.007,_t);\n"
" amaydrumR = vel*(clamp(1.95*_tri(drop_phase(_t2,.1,140.,114.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.24))+.07*clamp(.25*_tri(drop_phase(_t2,.1,140.,114.)+.07*lpnoise(_t2,4577.)),-1.,1.)*exp(-11.43*_t2)+0.*lpnoise(_t2,13098.)*(1.-smoothstep(0.,.32,_t2-.76))+.75*lpnoise(_t2,7668.)*exp(-_t2*5.99)+.96*lpnoise(_t2,1984.)*exp(-_t2*20.65))*smoothstep(0.,.007,_t2);\n"
" }\n"
" else if(drum == 8){\n"
" amaydrumL = vel*(.3+(.7*theta(Bprog)*exp(-10.*Bprog)))*sinshape(((clamp(.72*_tri(drop_phase(_t,.07,227.,107.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.09))+.69*clamp(.94*_tri(drop_phase(_t,.07,227.,107.)+.69*lpnoise(_t,8709.)),-1.,1.)*exp(-13.89*_t)+.06*lpnoise(_t,18745.)*(1.-smoothstep(0.,.67,_t-.17))+.28*lpnoise(_t,7506.)*exp(-_t*12.44)+.82*lpnoise(_t,2600.)*exp(-_t*17.54))*smoothstep(0.,.004,_t)),.6,9.);\n"
" amaydrumR = vel*(.3+(.7*theta(Bprog)*exp(-10.*Bprog)))*sinshape(((clamp(.72*_tri(drop_phase(_t2,.07,227.,107.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.09))+.69*clamp(.94*_tri(drop_phase(_t2,.07,227.,107.)+.69*lpnoise(_t2,8709.)),-1.,1.)*exp(-13.89*_t2)+.06*lpnoise(_t2,18745.)*(1.-smoothstep(0.,.67,_t2-.17))+.28*lpnoise(_t2,7506.)*exp(-_t2*12.44)+.82*lpnoise(_t2,2600.)*exp(-_t2*17.54))*smoothstep(0.,.004,_t2)),.6,9.);\n"
" }\n"
" else if(drum == 12){\n"
" amaydrumL = vel*(.79*lpnoise(_t,1.+3.31*_t)*(smoothstep(0.,1e-3,_t)-smoothstep(0.,.018,_t-.196)));\n"
" amaydrumR = vel*(.79*lpnoise(_t2,1.+3.31*_t2)*(smoothstep(0.,1e-3,_t2)-smoothstep(0.,.018,_t2-.196)));\n"
" }\n"
" else if(drum == 13){\n"
" amaydrumL = vel*((clamp(1.09*_tri(drop_phase(_t,.08,249.,77.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.04))+.97*clamp(.99*_tri(drop_phase(_t,.08,249.,77.)+.97*lpnoise(_t,9855.)),-1.,1.)*exp(-21.22*_t)+.03*lpnoise(_t,10655.)*(1.-smoothstep(0.,.58,_t-.81))+.71*lpnoise(_t,7520.)*exp(-_t*16.22)+.57*lpnoise(_t,4386.)*exp(-_t*29.48))*smoothstep(0.,.005,_t));\n"
" amaydrumR = vel*((clamp(1.09*_tri(drop_phase(_t2,.08,249.,77.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.04))+.97*clamp(.99*_tri(drop_phase(_t2,.08,249.,77.)+.97*lpnoise(_t2,9855.)),-1.,1.)*exp(-21.22*_t2)+.03*lpnoise(_t2,10655.)*(1.-smoothstep(0.,.58,_t2-.81))+.71*lpnoise(_t2,7520.)*exp(-_t2*16.22)+.57*lpnoise(_t2,4386.)*exp(-_t2*29.48))*smoothstep(0.,.005,_t2));\n"
" }\n"
" else if(drum == 14){\n"
" amaydrumL = vel*.42*((clamp(2.24*_tri(drop_phase(_t,.08,217.,64.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.29))+.7*clamp(.84*_tri(drop_phase(_t,.08,217.,64.)+.7*lpnoise(_t,1936.)),-1.,1.)*exp(-23.11*_t)+.08*lpnoise(_t,5166.)*(1.-smoothstep(0.,.16,_t-.55))+.77*lpnoise(_t,6784.)*exp(-_t*29.89)+.53*lpnoise(_t,4404.)*exp(-_t*24.64))*smoothstep(0.,.002,_t));\n"
" amaydrumR = vel*.42*((clamp(2.24*_tri(drop_phase(_t2,.08,217.,64.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.29))+.7*clamp(.84*_tri(drop_phase(_t2,.08,217.,64.)+.7*lpnoise(_t2,1936.)),-1.,1.)*exp(-23.11*_t2)+.08*lpnoise(_t2,5166.)*(1.-smoothstep(0.,.16,_t2-.55))+.77*lpnoise(_t2,6784.)*exp(-_t2*29.89)+.53*lpnoise(_t2,4404.)*exp(-_t2*24.64))*smoothstep(0.,.002,_t2));\n"
" }\n"
" else if(drum == 19){\n"
" amaydrumL = vel*(.61*(0.*lpnoise(_t,385.)+0.*lpnoise(_t,2973.)+0.*lpnoise(_t,1554.))*(smoothstep(0.,.01,_t)-smoothstep(0.,.54,_t-.02))+_sin(drop_phase(_t,.03,638.,304.))*exp(-_t*9.7)*.1+_sin(drop_phase(_t*1541.,.03,638.,304.))*exp(-_t*2.8)*.91);\n"
" amaydrumR = vel*(.61*(0.*lpnoise(_t2,385.)+0.*lpnoise(_t2,2973.)+0.*lpnoise(_t2,1554.))*(smoothstep(0.,.01,_t2)-smoothstep(0.,.54,_t2-.02))+_sin(drop_phase(_t2,.03,638.,304.))*exp(-_t2*9.7)*.1+_sin(drop_phase(_t2*1541.,.03,638.,304.))*exp(-_t2*2.8)*.91);\n"
" }\n"
" else if(drum == 20){\n"
" amaydrumL = vel*(.25*(0.*lpnoise(_t,260.)+0.*lpnoise(_t,868.)+0.*lpnoise(_t,454.))*(smoothstep(0.,.01,_t)-smoothstep(0.,.91,_t-.91))+_sin(drop_phase(_t,.02,559.,252.))*exp(-_t*5.5)*.4+_sin(drop_phase(_t*1444.,.02,559.,252.))*exp(-_t*6.9)*.3);\n"
" amaydrumR = vel*(.25*(0.*lpnoise(_t2,260.)+0.*lpnoise(_t2,868.)+0.*lpnoise(_t2,454.))*(smoothstep(0.,.01,_t2)-smoothstep(0.,.91,_t2-.91))+_sin(drop_phase(_t2,.02,559.,252.))*exp(-_t2*5.5)*.4+_sin(drop_phase(_t2*1444.,.02,559.,252.))*exp(-_t2*6.9)*.3);\n"
" }\n"
" else if(drum == 23){\n"
" amaydrumL = vel*((clamp(2.65*_tri(drop_phase(_t,.06,205.,52.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.09))+.91*clamp(.95*_tri(drop_phase(_t,.06,205.,52.)+.91*lpnoise(_t,8869.)),-1.,1.)*exp(-14.86*_t)+.04*lpnoise(_t,16440.)*(1.-smoothstep(0.,.77,_t-.52))+.16*lpnoise(_t,1524.)*exp(-_t*6.23)+.07*lpnoise(_t,5944.)*exp(-_t*13.51))*smoothstep(0.,.004,_t));\n"
" amaydrumR = vel*((clamp(2.65*_tri(drop_phase(_t2,.06,205.,52.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.09))+.91*clamp(.95*_tri(drop_phase(_t2,.06,205.,52.)+.91*lpnoise(_t2,8869.)),-1.,1.)*exp(-14.86*_t2)+.04*lpnoise(_t2,16440.)*(1.-smoothstep(0.,.77,_t2-.52))+.16*lpnoise(_t2,1524.)*exp(-_t2*6.23)+.07*lpnoise(_t2,5944.)*exp(-_t2*13.51))*smoothstep(0.,.004,_t2));\n"
" }\n"
" else if(drum == 24){\n"
" amaydrumL = vel*protokick(_t,242.,55.,.036,.088,.0666,1.42,.01,.45,.1,.15,.5)\n"
" +.66*protokick(_t,3333.,340.,.008,0.,.01,2.,2.4,0.,.2,.3,1.);\n"
" amaydrumR = vel*protokick(_t2,242.,55.,.036,.088,.0666,1.42,.01,.45,.1,.15,.5)\n"
" +.66*protokick(_t2,3333.,340.,.008,0.,.01,2.,2.4,0.,.2,.3,1.);\n"
" }\n"
" else if(drum == 25){\n"
" amaydrumL = vel*protokick(_t,3333.,340.,.008,0.,.01,2.,2.4,0.,.2,.3,1.);\n"
" amaydrumR = vel*protokick(_t2,3333.,340.,.008,0.,.01,2.,2.4,0.,.2,.3,1.);\n"
" }\n"
" else if(drum == 26){\n"
" amaydrumL = vel*((clamp(2.77*_tri(drop_phase(_t,.04,346.,71.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.15))+.93*clamp(.5*_tri(drop_phase(_t,.04,346.,71.)+.93*lpnoise(_t,8131.)),-1.,1.)*exp(-27.17*_t)+.05*lpnoise(_t,8351.)*(1.-smoothstep(0.,.7,_t-.56))+.22*lpnoise(_t,6693.)*exp(-_t*8.03)+.66*lpnoise(_t,6124.)*exp(-_t*14.68))*smoothstep(0.,.003,_t));\n"
" amaydrumR = vel*((clamp(2.77*_tri(drop_phase(_t2,.04,346.,71.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.15))+.93*clamp(.5*_tri(drop_phase(_t2,.04,346.,71.)+.93*lpnoise(_t2,8131.)),-1.,1.)*exp(-27.17*_t2)+.05*lpnoise(_t2,8351.)*(1.-smoothstep(0.,.7,_t2-.56))+.22*lpnoise(_t2,6693.)*exp(-_t2*8.03)+.66*lpnoise(_t2,6124.)*exp(-_t2*14.68))*smoothstep(0.,.003,_t2));\n"
" }\n"
" else if(drum == 27){\n"
" amaydrumL = vel*((clamp(1.18*_tri(drop_phase(_t,.07,170.,94.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.12))+.08*clamp(.41*_tri(drop_phase(_t,.07,170.,94.)+.08*lpnoise(_t,8015.)),-1.,1.)*exp(-8.8*_t)+.03*lpnoise(_t,1351.)*(1.-smoothstep(0.,.35,_t-.3))+.62*lpnoise(_t,2610.)*exp(-_t*18.02)+.27*lpnoise(_t,4995.)*exp(-_t*27.9))*smoothstep(0.,.009,_t));\n"
" amaydrumR = vel*((clamp(1.18*_tri(drop_phase(_t2,.07,170.,94.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.12))+.08*clamp(.41*_tri(drop_phase(_t2,.07,170.,94.)+.08*lpnoise(_t2,8015.)),-1.,1.)*exp(-8.8*_t2)+.03*lpnoise(_t2,1351.)*(1.-smoothstep(0.,.35,_t2-.3))+.62*lpnoise(_t2,2610.)*exp(-_t2*18.02)+.27*lpnoise(_t2,4995.)*exp(-_t2*27.9))*smoothstep(0.,.009,_t2));\n"
" }\n"
" else if(drum == 28){\n"
" amaydrumL = vel*sinshape(lpnoise(_t + 0.,10396.),.3,7.)*theta(Bprog)*exp(-8.*Bprog);\n"
" amaydrumR = vel*sinshape(lpnoise(_t2 + 0.,10396.),.3,7.)*theta(Bprog)*exp(-8.*Bprog);\n"
" }\n"
" else if(drum == 29){\n"
" amaydrumL = vel*(vel*(clamp(1.32*_tri(drop_phase(_t,.06,308.,80.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.15))+.82*clamp(.49*_tri(drop_phase(_t,.06,308.,80.)+.82*lpnoise(_t,4595.)),-1.,1.)*exp(-1.97*_t)+.09*lpnoise(_t,4032.)*(1.-smoothstep(0.,.97,_t-.79))+.1*lpnoise(_t,1111.)*exp(-_t*12.69)+.6*lpnoise(_t,7795.)*exp(-_t*1.08))*smoothstep(0.,.003,_t))\n"
" +.5*((clamp(1.35*_tri(drop_phase(_t,.07,244.,112.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.09))+.27*clamp(.03*_tri(drop_phase(_t,.07,244.,112.)+.27*lpnoise(_t,5148.)),-1.,1.)*exp(-24.07*_t)+0.*lpnoise(_t,1959.)*(1.-smoothstep(0.,.98,_t-.64))+.43*lpnoise(_t,8238.)*exp(-_t*25.54)+.11*lpnoise(_t,3803.)*exp(-_t*10.51))*smoothstep(0.,.006,_t));\n"
" amaydrumR = vel*(vel*(clamp(1.32*_tri(drop_phase(_t2,.06,308.,80.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.15))+.82*clamp(.49*_tri(drop_phase(_t2,.06,308.,80.)+.82*lpnoise(_t2,4595.)),-1.,1.)*exp(-1.97*_t2)+.09*lpnoise(_t2,4032.)*(1.-smoothstep(0.,.97,_t2-.79))+.1*lpnoise(_t2,1111.)*exp(-_t2*12.69)+.6*lpnoise(_t2,7795.)*exp(-_t2*1.08))*smoothstep(0.,.003,_t2))\n"
" +.5*((clamp(1.35*_tri(drop_phase(_t2,.07,244.,112.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.09))+.27*clamp(.03*_tri(drop_phase(_t2,.07,244.,112.)+.27*lpnoise(_t2,5148.)),-1.,1.)*exp(-24.07*_t2)+0.*lpnoise(_t2,1959.)*(1.-smoothstep(0.,.98,_t2-.64))+.43*lpnoise(_t2,8238.)*exp(-_t2*25.54)+.11*lpnoise(_t2,3803.)*exp(-_t2*10.51))*smoothstep(0.,.006,_t2));\n"
" }\n"
" else if(drum == 33){\n"
" amaydrumL = vel*((clamp(2.58*_tri(drop_phase(_t,.05,156.,91.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.04))+.35*clamp(.44*_tri(drop_phase(_t,.05,156.,91.)+.35*lpnoise(_t,6183.)),-1.,1.)*exp(-7.56*_t)+.08*lpnoise(_t,7245.)*(1.-smoothstep(0.,.58,_t-.2))+.72*lpnoise(_t,2591.)*exp(-_t*5.48)+.73*lpnoise(_t,3597.)*exp(-_t*29.4))*smoothstep(0.,.01,_t));\n"
" amaydrumR = vel*((clamp(2.58*_tri(drop_phase(_t2,.05,156.,91.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.04))+.35*clamp(.44*_tri(drop_phase(_t2,.05,156.,91.)+.35*lpnoise(_t2,6183.)),-1.,1.)*exp(-7.56*_t2)+.08*lpnoise(_t2,7245.)*(1.-smoothstep(0.,.58,_t2-.2))+.72*lpnoise(_t2,2591.)*exp(-_t2*5.48)+.73*lpnoise(_t2,3597.)*exp(-_t2*29.4))*smoothstep(0.,.01,_t2));\n"
" }\n"
" else if(drum == 34){\n"
" amaydrumL = vel*((clamp(1.42*_tri(drop_phase(_t,.02,261.,53.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.28))+.86*clamp(.04*_tri(drop_phase(_t,.02,261.,53.)+.86*lpnoise(_t,3210.)),-1.,1.)*exp(-20.77*_t)+.03*lpnoise(_t,2325.)*(1.-smoothstep(0.,.42,_t-.01))+.28*lpnoise(_t,4276.)*exp(-_t*14.57)+.72*lpnoise(_t,3219.)*exp(-_t*9.93))*smoothstep(0.,.007,_t));\n"
" amaydrumR = vel*((clamp(1.42*_tri(drop_phase(_t2,.02,261.,53.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.28))+.86*clamp(.04*_tri(drop_phase(_t2,.02,261.,53.)+.86*lpnoise(_t2,3210.)),-1.,1.)*exp(-20.77*_t2)+.03*lpnoise(_t2,2325.)*(1.-smoothstep(0.,.42,_t2-.01))+.28*lpnoise(_t2,4276.)*exp(-_t2*14.57)+.72*lpnoise(_t2,3219.)*exp(-_t2*9.93))*smoothstep(0.,.007,_t2));\n"
" }\n"
" else if(drum == 39){\n"
" amaydrumL = vel*((clamp(2.27*_tri(drop_phase(_t,.03,241.,72.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t-.01))+.91*clamp(.9*_tri(drop_phase(_t,.03,241.,72.)+.91*lpnoise(_t,8164.)),-1.,1.)*exp(-20.76*_t)+.05*lpnoise(_t,10466.)*(1.-smoothstep(0.,.18,_t-.56))+.56*lpnoise(_t,7123.)*exp(-_t*5.45)+.11*lpnoise(_t,1134.)*exp(-_t*13.82))*smoothstep(0.,.004,_t));\n"
" amaydrumR = vel*((clamp(2.27*_tri(drop_phase(_t2,.03,241.,72.)),-1.,1.)*(1.-smoothstep(-1e-3,0.,_t2-.01))+.91*clamp(.9*_tri(drop_phase(_t2,.03,241.,72.)+.91*lpnoise(_t2,8164.)),-1.,1.)*exp(-20.76*_t2)+.05*lpnoise(_t2,10466.)*(1.-smoothstep(0.,.18,_t2-.56))+.56*lpnoise(_t2,7123.)*exp(-_t2*5.45)+.11*lpnoise(_t2,1134.)*exp(-_t2*13.82))*smoothstep(0.,.004,_t2));\n"
" }\n"
" \n"
" dL += amtL * s_atan(env * amaydrumL);\n"
" dR += amtR * s_atan(env * amaydrumR);\n"
" }\n"
" else\n"
" {\n"
" f = freqC1(note_pitch(_note) + mod_transp(_mod));\n"
"\n"
" if(abs(slide) > 1e-3) // THIS IS SLIDEY BIZ\n"
" {\n"
" float Bslide = trk_slide(trk);\n"
" float fac = slide * log(2.)/12.;\n"
" if (Bprog <= Bslide)\n"
" {\n"
" float help = 1. - Bprog/Bslide;\n"
" f *= Bslide * (fhelp(fac) - help * fhelp(fac*help*help)) / Bprog;\n"
" }\n"
" else\n"
" {\n"
" f *= 1. + (Bslide * (fhelp(fac)-1.)) / Bprog;\n"
" }\n"
" }\n"
"\n"
" env = theta(Bprog) * (1. - smoothstep(Boff-rel, Boff, B));\n"
" if(syn == 0){amaysynL = _sin(f*_t); amaysynR = _sin(f*_t2);}\n"
" else if(syn == 18){\n"
" amaysynL = env_AHDSR(Bprog,L,.1+.001*aux,0.,.1,1.,.15)*(.5*sinshape(_tri(f*(_t-0.0*(1.+.1*_sin(.025*SPB*_t)))+.005*aux*env_AHDSR(Bprog,L,.125,0.,.1,1.,0.)*(2.*fract(.5*f*(_t-0.0*(1.+.1*_sin(.025*SPB*_t))))-1.)+.01*aux*env_AHDSR(Bprog,L,.05+.006*aux,0.,.1,1.,0.)*clip((1.+.8)*(2.*fract(1.51*f*(_t-0.0*(1.+.1*_sin(.025*SPB*_t))))-1.)))+.6*clip((1.+.4)*_sin(.499*f*(_t-0.0*(1.+.1*_sin(.025*SPB*_t))))),.2+.03*aux*vel,3.)\n"
" +.5*sinshape(_tri(f*(_t-1.0e-01*(1.+.1*_sin(.025*SPB*_t)))+.005*aux*env_AHDSR(Bprog,L,.125,0.,.1,1.,0.)*(2.*fract(.5*f*(_t-1.0e-01*(1.+.1*_sin(.025*SPB*_t))))-1.)+.01*aux*env_AHDSR(Bprog,L,.05+.006*aux,0.,.1,1.,0.)*clip((1.+.8)*(2.*fract(1.51*f*(_t-1.0e-01*(1.+.1*_sin(.025*SPB*_t))))-1.)))+.6*clip((1.+.4)*_sin(.499*f*(_t-1.0e-01*(1.+.1*_sin(.025*SPB*_t))))),.2+.03*aux*vel,3.))\n"
" +.5*sinshape(_tri(f*floor(7888.*_t+.5)/7888.+.005*aux*env_AHDSR(Bprog,L,.125,0.,.1,1.,0.)*(2.*fract(.5*f*floor(7888.*_t+.5)/7888.)-1.)+.01*aux*env_AHDSR(Bprog,L,.05+.006*aux,0.,.1,1.,0.)*clip((1.+.8)*(2.*fract(1.51*f*floor(7888.*_t+.5)/7888.)-1.)))+.6*clip((1.+.4)*_sin(.499*f*floor(7888.*_t+.5)/7888.)),.2+.03*aux*vel,3.)*env_AHDSR(Bprog,L,.1+.001*aux,0.,.1,1.,.15);\n"
" amaysynR = env_AHDSR(Bprog,L,.1+.001*aux,0.,.1,1.,.15)*(.5*sinshape(_tri(f*(_t2-0.0*(1.+.1*_sin(.025*SPB*_t2)))+.005*aux*env_AHDSR(Bprog,L,.125,0.,.1,1.,0.)*(2.*fract(.5*f*(_t2-0.0*(1.+.1*_sin(.025*SPB*_t2))))-1.)+.01*aux*env_AHDSR(Bprog,L,.05+.006*aux,0.,.1,1.,0.)*clip((1.+.8)*(2.*fract(1.51*f*(_t2-0.0*(1.+.1*_sin(.025*SPB*_t2))))-1.)))+.6*clip((1.+.4)*_sin(.499*f*(_t2-0.0*(1.+.1*_sin(.025*SPB*_t2))))),.2+.03*aux*vel,3.)\n"
" +.5*sinshape(_tri(f*(_t2-1.0e-01*(1.+.1*_sin(.025*SPB*_t2)))+.005*aux*env_AHDSR(Bprog,L,.125,0.,.1,1.,0.)*(2.*fract(.5*f*(_t2-1.0e-01*(1.+.1*_sin(.025*SPB*_t2))))-1.)+.01*aux*env_AHDSR(Bprog,L,.05+.006*aux,0.,.1,1.,0.)*clip((1.+.8)*(2.*fract(1.51*f*(_t2-1.0e-01*(1.+.1*_sin(.025*SPB*_t2))))-1.)))+.6*clip((1.+.4)*_sin(.499*f*(_t2-1.0e-01*(1.+.1*_sin(.025*SPB*_t2))))),.2+.03*aux*vel,3.))\n"
" +.5*sinshape(_tri(f*floor(7888.*_t2+.5)/7888.+.005*aux*env_AHDSR(Bprog,L,.125,0.,.1,1.,0.)*(2.*fract(.5*f*floor(7888.*_t2+.5)/7888.)-1.)+.01*aux*env_AHDSR(Bprog,L,.05+.006*aux,0.,.1,1.,0.)*clip((1.+.8)*(2.*fract(1.51*f*floor(7888.*_t2+.5)/7888.)-1.)))+.6*clip((1.+.4)*_sin(.499*f*floor(7888.*_t2+.5)/7888.)),.2+.03*aux*vel,3.)*env_AHDSR(Bprog,L,.1+.001*aux,0.,.1,1.,.15);\n"
" }\n"
" else if(syn == 56){\n"
" amaysynL = ((QFM((_t-0.0*(1.+.5*_sin(1.1*_t))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t-4.0e-04*(1.+.5*_sin(1.1*_t))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t-8.0e-04*(1.+.5*_sin(1.1*_t))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t-1.2e-03*(1.+.5*_sin(1.1*_t))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t-1.6e-03*(1.+.5*_sin(1.1*_t))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t-2.0e-03*(1.+.5*_sin(1.1*_t))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t-2.4e-03*(1.+.5*_sin(1.1*_t))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t-2.8e-03*(1.+.5*_sin(1.1*_t))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t-3.2e-03*(1.+.5*_sin(1.1*_t))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t-3.6e-03*(1.+.5*_sin(1.1*_t))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.))*theta(Bprog)*exp(-3.*vel*Bprog)+.6*theta(Bprog)*exp(-3.*vel*Bprog)*sinshape(.8*MADD(_t,.5*f,0.,64,1,-.5,200.,10.,0.,3.,.013,.02*aux,0)+.2*MADD(_t,.999*f,0.,64,1,-.7,500.,10.,0.,3.,.013,.01*aux,0),.01*aux,3.));\n"
" amaysynR = ((QFM((_t2-0.0*(1.+.5*_sin(1.1*_t2))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t2-4.0e-04*(1.+.5*_sin(1.1*_t2))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t2-8.0e-04*(1.+.5*_sin(1.1*_t2))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t2-1.2e-03*(1.+.5*_sin(1.1*_t2))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t2-1.6e-03*(1.+.5*_sin(1.1*_t2))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t2-2.0e-03*(1.+.5*_sin(1.1*_t2))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t2-2.4e-03*(1.+.5*_sin(1.1*_t2))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t2-2.8e-03*(1.+.5*_sin(1.1*_t2))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t2-3.2e-03*(1.+.5*_sin(1.1*_t2))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.)+QFM((_t2-3.6e-03*(1.+.5*_sin(1.1*_t2))),f,0.,.00787*126.,.00787*env_AHDSR(Bprog,L,.228*vel,.231,.183,.383,0.)*66.,.00787*env_AHDSR(Bprog,L,.06*vel,.196,.202,.27,0.)*68.,.00787*env_AHDSR(Bprog,L,.06*vel,.016,.1,.342,0.)*111.,.5,1.,1.001,1.,.00787*74.,.00787*86.,.00787*77.,.00787*4.,2.))*theta(Bprog)*exp(-3.*vel*Bprog)+.6*theta(Bprog)*exp(-3.*vel*Bprog)*sinshape(.8*MADD(_t2,.5*f,0.,64,1,-.5,200.,10.,0.,3.,.013,.02*aux,0)+.2*MADD(_t2,.999*f,0.,64,1,-.7,500.,10.,0.,3.,.013,.01*aux,0),.01*aux,3.));\n"
" }\n"
" else if(syn == 71){\n"
" amaysynL = (env_AHDSR(_t,tL,1e-3,0.,.063,.402,.003)*MADD(_t,f,0.,128,1,-.6,(1175.+(583.*_sin_(2.*B,.4))),24.,44.37,24.05,.015,.4*(.55+(.4*clip((1.+1.)*_sin(4.*B)))),0));\n"
" amaysynR = (env_AHDSR(_t2,tL,1e-3,0.,.063,.402,.003)*MADD(_t2,f,0.,128,1,-.6,(1175.+(583.*_sin_(2.*B,.4))),24.,44.37,24.05,.015,.4*(.55+(.4*clip((1.+1.)*_sin(4.*B)))),0));\n"
"env = theta(Bprog)*pow(1.-smoothstep(Boff-rel, Boff, B),2);\n"
" }\n"
" else if(syn == 81){\n"
" amaysynL = (vel*waveshape(QFM(_t,f,0.,.00787*0.,.00787*119.,.00787*92.,.00787*101.,.5,1.,1.001,1.,.00787*100.,.00787*61.,.00787*25.,.00787*9.,1.),(.5+(.5*_sin(.4*B))),.05,.46,.3,.7,.8)*env_AHDSR(_t,tL,.2,0.,.01,1.,.05)+vel*clip((1.+2.)*_sin(f*_t)));\n"
" amaysynR = (vel*waveshape(QFM(_t2,f,0.,.00787*0.,.00787*119.,.00787*92.,.00787*101.,.5,1.,1.001,1.,.00787*100.,.00787*61.,.00787*25.,.00787*9.,1.),(.5+(.5*_sin(.4*B))),.05,.46,.3,.7,.8)*env_AHDSR(_t2,tL,.2,0.,.01,1.,.05)+vel*clip((1.+2.)*_sin(f*_t2)));\n"
" }\n"
" else if(syn == 90){\n"
" amaysynL = (vel*env_AHDSR(_t,tL,.398,0.,.1,1.,.388)*waveshape(MADD(_t,f,0.,80,1,-.95,(1922.+(1572.*clip((1.+.0297)*_sin((.861-.088*aux)*B)))),12.267,.594,8.74,.008,-.75,0),0.,.1,.5,.2,.5,.6));\n"
" amaysynR = (vel*env_AHDSR(_t2,tL,.398,0.,.1,1.,.388)*waveshape(MADD(_t2,f,0.,80,1,-.95,(1922.+(1572.*clip((1.+.0297)*_sin((.861-.088*aux)*B)))),12.267,.594,8.74,.008,-.75,0),0.,.1,.5,.2,.5,.6));\n"
"env = theta(Bprog)*pow(1.-smoothstep(Boff-rel, Boff, B),3);\n"
" }\n"
" else if(syn == 101){\n"
" amaysynL = (vel*env_AHDSR(_t,tL,.158+0.05*aux,0.,.1,1.,.17)*waveshape(MADD(_t,f,0.,256,1,-.388,(5141.+(2277.*clip((1.+.681)*_sin(.126*B)))),9.292,1.023,4.85,.016,-.86,0),-.86,.1,.5,.2,.5,.6)+.5*vel*env_AHDSR(_t,tL,.158+0.04*aux,0.,.1,1.,.17)*MADD(_t,.501*f,0.,64,1,-.388,(5141.+(2277.*clip((1.+.681)*_sin(.126*B)))),9.292,1.023,4.85,.016,.2*-.86,0));\n"
" amaysynR = (vel*env_AHDSR(_t2,tL,.158+0.05*aux,0.,.1,1.,.17)*waveshape(MADD(_t2,f,0.,256,1,-.388,(5141.+(2277.*clip((1.+.681)*_sin(.126*B)))),9.292,1.023,4.85,.016,-.86,0),-.86,.1,.5,.2,.5,.6)+.5*vel*env_AHDSR(_t2,tL,.158+0.04*aux,0.,.1,1.,.17)*MADD(_t2,.501*f,0.,64,1,-.388,(5141.+(2277.*clip((1.+.681)*_sin(.126*B)))),9.292,1.023,4.85,.016,.2*-.86,0));\n"
"env = theta(Bprog)*pow(1.-smoothstep(Boff-rel, Boff, B),4);\n"
" }\n"
" else if(syn == 112){\n"
" amaysynL = (vel*sinshape(QFM(_t,f,0.,.00787*103.,.00787*env_AHDSR(Bprog,L,.0001,.024,.11,.185,0.)*0.,.00787*env_AHDSR(Bprog,L,.0001,.19,.161,.096,0.)*2.,.00787*env_AHDSR(Bprog,L,.0001,.16,.197,.035,0.)*85.,.999,1.,1.+.0084*(.5+(.5*_sin(.01*Bprog))),2.,.00787*30.,.00787*37.,.00787*117.,.00787*32.,11.),.03*aux,3.)*env_AHDSR(Bprog,L,.0001,.015,.071,.66,.003));\n"
" amaysynR = (vel*sinshape(QFM(_t2,f,0.,.00787*103.,.00787*env_AHDSR(Bprog,L,.0001,.024,.11,.185,0.)*0.,.00787*env_AHDSR(Bprog,L,.0001,.19,.161,.096,0.)*2.,.00787*env_AHDSR(Bprog,L,.0001,.16,.197,.035,0.)*85.,.999,1.,1.+.0084*(.5+(.5*_sin(.01*Bprog))),2.,.00787*30.,.00787*37.,.00787*117.,.00787*32.,11.),.03*aux,3.)*env_AHDSR(Bprog,L,.0001,.015,.071,.66,.003));\n"
"env = theta(Bprog)*pow(1.-smoothstep(Boff-rel, Boff, B),3);\n"
" }\n"
" else if(syn == 115){\n"
" amaysynL = (vel*sinshape(QFM(_t,f,0.,.00787*101.,.00787*env_AHDSR(Bprog,L,.0001,.213,.215,.02,0.)*39.,.00787*env_AHDSR(Bprog,L,.0001,.216,.123,.054,0.)*122.,.00787*env_AHDSR(Bprog,L,.0001,.214,.243,.174,0.)*21.,.999,1.,1.+.0285*(.5+(.5*_sin(.24*Bprog))),2.,.00787*28.,.00787*43.,.00787*95.,.00787*115.,10.),.03*aux,3.)*env_AHDSR(Bprog,L,.0001,.03,.15,.177,.102));\n"
" amaysynR = (vel*sinshape(QFM(_t2,f,0.,.00787*101.,.00787*env_AHDSR(Bprog,L,.0001,.213,.215,.02,0.)*39.,.00787*env_AHDSR(Bprog,L,.0001,.216,.123,.054,0.)*122.,.00787*env_AHDSR(Bprog,L,.0001,.214,.243,.174,0.)*21.,.999,1.,1.+.0285*(.5+(.5*_sin(.24*Bprog))),2.,.00787*28.,.00787*43.,.00787*95.,.00787*115.,10.),.03*aux,3.)*env_AHDSR(Bprog,L,.0001,.03,.15,.177,.102));\n"
" }\n"
" else if(syn == 117){\n"
" amaysynL = (vel*sinshape(QFM(_t,f,0.,.00787*125.,.00787*env_AHDSR(Bprog,L,.0001,.047,.01,.404,0.)*20.,.00787*env_AHDSR(Bprog,L,.0001,.151,.071,.069,0.)*110.,.00787*env_AHDSR(Bprog,L,.0001,.232,.08,.003,0.)*65.,.999,1.,1.+.0799*(.5+(.5*_sin(.18*Bprog))),2.,.00787*109.,.00787*21.,.00787*94.,.00787*0.,11.),.03*aux,3.)*env_AHDSR(Bprog,L,.0001,.03,.167,.796,.114))\n"
" +_sq_(.501*f*_t,.4+.3*(.5+(.5*_sin(.8*Bprog))))\n"
" +.6*clip((1.+.2*aux)*_sin(.25*f*_t));\n"
" amaysynR = (vel*sinshape(QFM(_t2,f,0.,.00787*125.,.00787*env_AHDSR(Bprog,L,.0001,.047,.01,.404,0.)*20.,.00787*env_AHDSR(Bprog,L,.0001,.151,.071,.069,0.)*110.,.00787*env_AHDSR(Bprog,L,.0001,.232,.08,.003,0.)*65.,.999,1.,1.+.0799*(.5+(.5*_sin(.18*Bprog))),2.,.00787*109.,.00787*21.,.00787*94.,.00787*0.,11.),.03*aux,3.)*env_AHDSR(Bprog,L,.0001,.03,.167,.796,.114))\n"
" +_sq_(.501*f*_t2,.4+.3*(.5+(.5*_sin(.8*Bprog))))\n"
" +.6*clip((1.+.2*aux)*_sin(.25*f*_t2));\n"
" }\n"
" else if(syn == 118){\n"
" amaysynL = env_AHDSR(Bprog,L,.05,0.,.05,.8,.5)*s_atan(23.*(s_atan(MADD(_t,.5*f,lpnoise(_t + 0.,500.)*theta(Bprog)*exp(-10.*Bprog),8,1,(.4+(.6*_sin(.21*Bprog))),2000.,100.,5.,100.,.001,.7,0)+MADD(_t,1.01*.5*f,lpnoise(_t + 0.,500.)*theta(Bprog)*exp(-10.*Bprog),8,1,(.4+(.6*_sin(.21*Bprog))),2000.,100.,5.,100.,.001,.7,0)+MADD(_t,2.005*.5*f,lpnoise(_t + 0.,500.)*theta(Bprog)*exp(-10.*Bprog),8,1,(.4+(.6*_sin(.21*Bprog))),2000.,100.,5.,100.,.001,.7,0)+MADD(_t,.499*.5*f,lpnoise(_t + 0.,500.)*theta(Bprog)*exp(-10.*Bprog),8,1,(.4+(.6*_sin(.21*Bprog))),2000.,100.,5.,100.,.001,.7,0))+.2*theta(Bprog)*exp(-10.*Bprog)*lpnoise(_t + 0.,500.)));\n"
" amaysynR = env_AHDSR(Bprog,L,.05,0.,.05,.8,.5)*s_atan(23.*(s_atan(MADD(_t2,.5*f,lpnoise(_t2 + 0.,500.)*theta(Bprog)*exp(-10.*Bprog),8,1,(.4+(.6*_sin(.21*Bprog))),2000.,100.,5.,100.,.001,.7,0)+MADD(_t2,1.01*.5*f,lpnoise(_t2 + 0.,500.)*theta(Bprog)*exp(-10.*Bprog),8,1,(.4+(.6*_sin(.21*Bprog))),2000.,100.,5.,100.,.001,.7,0)+MADD(_t2,2.005*.5*f,lpnoise(_t2 + 0.,500.)*theta(Bprog)*exp(-10.*Bprog),8,1,(.4+(.6*_sin(.21*Bprog))),2000.,100.,5.,100.,.001,.7,0)+MADD(_t2,.499*.5*f,lpnoise(_t2 + 0.,500.)*theta(Bprog)*exp(-10.*Bprog),8,1,(.4+(.6*_sin(.21*Bprog))),2000.,100.,5.,100.,.001,.7,0))+.2*theta(Bprog)*exp(-10.*Bprog)*lpnoise(_t2 + 0.,500.)));\n"
"env = theta(Bprog)*pow(1.-smoothstep(Boff-rel, Boff, B),8);\n"
" }\n"
" \n"
" sL += amtL * s_atan(trk_norm(trk) * clamp(env,0.,1.) * amaysynL);\n"
" sR += amtR * s_atan(trk_norm(trk) * clamp(env,0.,1.) * amaysynR);\n"
" }\n"
" }\n"
" }\n"
" }\n"
" return vec2(s_atan(sidechain * sL + dL), s_atan(sidechain * sR + dR));\n"
"}\n"
"\n"
"void main()\n"
"{\n"
" float t = (iBlockOffset + (gl_FragCoord.x) + (gl_FragCoord.y)*iTexSize)/iSampleRate;\n"
" vec2 y = mainSynth(t);\n"
" vec2 v = floor((0.5+0.5*y)*65535.0);\n"
" vec2 vl = mod(v,256.0)/255.0;\n"
" vec2 vh = floor(v/256.0)/255.0;\n"
" gl_FragColor = vec4(vl.x,vh.x,vl.y,vh.y);\n"
"}\n"
"\n"
;
#endif