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
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
|
<CsoundSynthesizer>
<CsOptions>
-+rtaudio=alsa -idevaudio -odevaudio -m0 -W -s -d -b128 -B512
</CsOptions>
<CsInstruments>
sr=16000
ksmps=64
nchnls=2
giScale = 1/sr
gainrev init 0
gaoutL init 0
gaoutR init 0
gasynth init 0
/*****************************
matrix for TamTam's SynthLab
*****************************/
zakinit 8, 32
/*****************************
opcodes needed by TamTam's SynthLab
*****************************/
opcode synthGrain, a, aaiiii
aindex, atrans, ifreq, iphase itable, itabdur xin
apha phasor ifreq, iphase
aenv tab apha, 42, 1
atrig = int(1-aenv)
apos samphold aindex, atrig
adur samphold atrans, atrig
aline = apha * adur * sr + apos
aline limit aline, 0 , itabdur
ag tablei aline, itable, 0
aout = ag * aenv
xout aout
endop
opcode ControlMatrice, i, iikkkk
iTable, iIndex, kc1, kc2, kc3, kc4 xin
iSomme table iIndex, iTable+3
if iSomme == 0 then
goto noparams
endif
iPar table iIndex, iTable
if iSomme == 1 then
kp = iPar
elseif iSomme == 3 then
kp = iPar * kc1
elseif iSomme == 5 then
kp = iPar * kc2
elseif iSomme == 7 then
kp = iPar * ((kc1 + kc2)*.5)
elseif iSomme == 9 then
kp = iPar * kc3
elseif iSomme == 11 then
kp = iPar * ((kc1 + kc3)*.5)
elseif iSomme == 13 then
kp = iPar * ((kc2 + kc3)*.5)
elseif iSomme == 15 then
kp = iPar * ((kc1 + kc2 + kc3)*.33)
elseif iSomme == 17 then
kp = iPar * kc4
elseif iSomme == 19 then
kp = iPar * ((kc1 + kc4)*.5)
elseif iSomme == 21 then
kp = iPar * ((kc2 + kc4)*.5)
elseif iSomme == 23 then
kp = iPar * ((kc1 + kc2 + kc4)*.33)
elseif iSomme == 25 then
kp = iPar * ((kc3 + kc4)*.5)
elseif iSomme == 27 then
kp = iPar * ((kc1 + kc3 + kc4)*.5)
elseif iSomme == 29 then
kp = iPar * ((kc2 + kc3 + kc4)*.33)
elseif iSomme == 31 then
kp = iPar * ((kc1 + kc2 + kc3 + kc4)*.25)
endif
if iTable == 5201 then
zkw kp, iIndex+1
elseif iTable == 5202 then
zkw kp, iIndex+17
endif
xout iIndex
noparams:
endop
opcode SourceMatrice, i, iaaaa
iIndex, as1, as2, as3, as4 xin
iSomme table iIndex-1, 5206
if iSomme == 0 then
goto noparams
endif
if iSomme == 1 then
as = as1
elseif iSomme == 2 then
as = as2
elseif iSomme == 3 then
as = as1 + as2
elseif iSomme == 4 then
as = as3
elseif iSomme == 5 then
as = as1 + as3
elseif iSomme == 6 then
as = as2 + as3
elseif iSomme == 7 then
as = as1 + as2 + as3
elseif iSomme == 8 then
as = as4
elseif iSomme == 9 then
as = as1 + as4
elseif iSomme == 10 then
as = as2 + as4
elseif iSomme == 11 then
as = as1 + as2 + as4
elseif iSomme == 12 then
as = as3 + as4
elseif iSomme == 13 then
as = as1 + as3 + as4
elseif iSomme == 14 then
as = as2 + as3 + as4
elseif iSomme == 15 then
as = as1 + as2 + as3 + as4
endif
zaw as, iIndex
xout iIndex
noparams:
endop
opcode FxMatrice, i, iaaaa
iIndex, as1, as2, as3, as4 xin
iSomme table iIndex-1, 5206
if iSomme == 0 then
goto noparams
endif
if iSomme == 1 then
as = as1
elseif iSomme == 2 then
as = as2
elseif iSomme == 3 then
as = as1 + as2
elseif iSomme == 4 then
as = as3
elseif iSomme == 5 then
as = as1 + as3
elseif iSomme == 6 then
as = as2 + as3
elseif iSomme == 7 then
as = as1 + as2 + as3
elseif iSomme == 8 then
as = as4
elseif iSomme == 9 then
as = as1 + as4
elseif iSomme == 10 then
as = as2 + as4
elseif iSomme == 11 then
as = as1 + as2 + as4
elseif iSomme == 12 then
as = as3 + as4
elseif iSomme == 13 then
as = as1 + as3 + as4
elseif iSomme == 14 then
as = as2 + as3 + as4
endif
zaw as, iIndex
xout iIndex
noparams:
endop
opcode control, k, ii
iControlNum, idur xin
iControlType table iControlNum-1, 5203
if iControlType == 0 then
goto nocontrol
endif
ioffset = (iControlNum-1)*4
iPar1 table ioffset, 5200
iPar2 table ioffset+1, 5200
iPar3 table ioffset+2, 5200
iPar4 table ioffset+3, 5200
if iControlType == 1 then
kControl lfo iPar1, iPar2, int(iPar3)
kControl = kControl+iPar4
elseif iControlType == 2 then
irange = (iPar2-iPar1)*.5
kControl randi irange, iPar3, iPar4-.001, 0, irange+iPar1
elseif iControlType == 3 then
kControl adsr iPar1*idur+.0001, iPar2*idur, iPar3, iPar4*idur
endif
xout kControl
nocontrol:
endop
opcode source, a, ii
iSourceNum, ipitch xin
iSourceType table iSourceNum+3, 5203
if iSourceType == 0 then
goto nosource
endif
ioffset = (iSourceNum-1)*4
kpara1 zkr ioffset+1
kpara2 zkr ioffset+2
kpara3 zkr ioffset+3
kpara4 zkr ioffset+4
iPar1 table ioffset, 5201
iPar2 table ioffset+1, 5201
iPar3 table ioffset+2, 5201
iPar4 table ioffset+3, 5201
if iSourceType == 1 then
aSource foscil 2000*kpara4, ipitch, kpara1, kpara2, kpara3, 1
elseif iSourceType == 2 then
aSource gbuzz 5000*kpara4, ipitch*kpara1, int(abs(kpara2))+5, 0, kpara3+0.01, 2
elseif iSourceType == 3 then
iPar2 = int(iPar2)
if iPar2 == 0 then
imode = 0
elseif iPar2 == 1 then
imode = 10
elseif iPar2 == 2 then
imode = 12
endif
aSource vco2 2000*kpara4, ipitch*kpara1, imode, 0.1, 0, iPar3
elseif iSourceType == 4 then
if iPar3 == 0 then
kvib = 0
goto novib
else
kvibenv linseg 0, .3, 1, p3-.3, 1
kvib oscil ipitch*.015, kpara3, 1
endif
novib:
aSource pluck 5000*kpara4, ipitch*(abs(kpara1))+.001+kvib, 40, 0, 6
aSource butterlp aSource, kpara2
elseif iSourceType == 5 then
if int(iPar1) == 0 then
ar rand 5000*kpara4
elseif int(iPar1) == 1 then
ar pinkish 5000*kpara4
elseif int(iPar1) == 2 then
ar gauss 5000*kpara4
endif
knoisebandwith limit abs(kpara3), 1, sr/2
aSource butterbp ar, kpara2, knoisebandwith
aSource balance aSource, ar
elseif iSourceType == 6 then
iSndpitch = p4/261.626
iLoopIndex = iPar2 * 3
ils table iLoopIndex, 5755
ile table iLoopIndex+1, 5755
icd table iLoopIndex+2, 5755
if ile == 0 then
ile = nsamp(5000+iPar2) * giScale - .01
endif
if icd == 0 then
icd = .01
endif
aSource flooper2 kpara4*.4, iSndpitch*abs(kpara1), ils, ile, icd, 5000+iPar2
aSource butterlp aSource, abs(kpara3)
elseif iSourceType == 7 then
kvoy = int(kpara2*3)
kform1 table kvoy, 4
kform2 table kvoy+1, 4
kform3 table kvoy+2, 4
kform1 port kform1, .1, 500
kform2 port kform2, .1, 1500
kform3 port kform3, .1, 2500
kvibadev randomi -.0852, .0152, .5
kvibfdev randomi -.032, .032, .5
kvibfreqrand randomi kpara3-.75, kpara3+.75, .2
kvibfatt linseg 0, .3, 1, p3-.3, 1
kvib oscili (1+kvibadev)*kvibfatt, (kvibfreqrand+kvibfdev), 1
kharm randomi 40, 50, 1.34
kmul randomi .80, .84, 1.45
kbam randomi 480., 510., 2.07
kfunddev randomi -.0053, .0052, 1.05
ar gbuzz kbam, (p4*kpara1*(1+kfunddev)+kvib), int(kharm), 0, kmul, 2
a1 resonx ar, kform1, 140, 2, 1
a2 resonx ar, kform2, 180, 2, 1
a3 resonx ar, kform3, 220, 2 , 1
aSource = ((a1*80)+(a2*55)+(a3*40))*kpara4
elseif iSourceType == 8 then
iSndPitch = p4/261.626
igrdur = .1
itable = 5000+iPar2
irealTable = 5500 + iSourceNum
itabdur = nsamp(itable)
ifreq = 1 / igrdur
kamp = kpara4 * .2
aindex upsamp abs(kpara3) * itabdur
atrans upsamp kpara1 * igrdur * iSndPitch
as1 synthGrain aindex, atrans, ifreq, 0.82, irealTable, itabdur
as2 synthGrain aindex, atrans, ifreq, .58, irealTable, itabdur
as3 synthGrain aindex, atrans, ifreq, .41, irealTable, itabdur
as4 synthGrain aindex, atrans, ifreq, 0.19, irealTable, itabdur
as5 synthGrain aindex, atrans, ifreq, 0, irealTable, itabdur
aSource = (as1+as2+as3+as4+as5)*kamp
aSource butterlp aSource, 7500
endif
aSource dcblock aSource
xout aSource
nosource:
endop
opcode effects, a, ii
iFxNum, ipitch xin
iFxType table iFxNum+7, 5203
if iFxType == 0 then
goto nofx
endif
as1 zar iFxNum
as2 zar iFxNum+4
as = as1+as2
ioffset = (iFxNum+3)*4
kpara1 zkr ioffset+1
kpara2 zkr ioffset+2
kpara3 zkr ioffset+3
kpara4 zkr ioffset+4
ioffset2 = (iFxNum-1)*4
iPar1 table ioffset2, 5202
iPar2 table ioffset2+1, 5202
iPar3 table ioffset2+2, 5202
iPar4 table ioffset2+3, 5202
if iFxType == 1 then
kwgfeed limit kpara3, 0, 1
aFx wguide1 as, abs(kpara1)+1, kpara2, kwgfeed
aFx = aFx*kpara4
elseif iFxType == 2 then
aFx lpf18 as*.0005, abs(kpara1)+20, kpara2, kpara3
aFx = aFx*5000*kpara4
elseif iFxType == 3 then
aFx bqrez as*kpara4, abs(kpara1)+20, abs(kpara2)+1, int(iPar3)
aFx balance aFx, as*kpara4
elseif iFxType == 4 then
amod lfo 1, kpara1, int(iPar3)
aFx = ((as*amod*kpara2)+(as*(1-kpara2)))*kpara4
elseif iFxType == 5 then
ain = as*kpara4
krevLength limit kpara1, 0.01, 10
arev reverb ain, krevLength
arev butterlp arev, kpara2
aFx = (arev*kpara3)+(as*(1-kpara3))
elseif iFxType == 6 then
fsig pvsanal as, 1024, 256, 1024, 1
ftps1 pvscale fsig, kpara1
aFx pvsynth ftps1
adry delay as, iPar2
aFx = ((aFx*kpara3)+(adry*(1-kpara3)))*kpara4
endif
xout aFx
nofx:
endop
/****************************************************************
Reverb + master out
*****************************************************************/
instr 200
gktime timek
koutGain chnget "masterVolume"
koutGain = koutGain * 0.01
gkduck init 1
gkduck port gkduck, .03, 1.
ain dcblock gainrev*0.05
arev reverb ain, 2.5
arev butterlp arev, 5000
aLeft butterlp gaoutL, 7500
aRight butterlp gaoutR, 7500
outs (arev + aLeft)*koutGain*gkduck, (arev + aRight) * koutGain*gkduck
gaoutL = 0
gaoutR = 0
gainrev = 0
endin
/****************************************************************
Handler audio input recording
****************************************************************/
instr 5201
ktim timeinsts
gkduck = .05
itab = p4
ain inch 1
krms rms ain
ktrig trigger krms, 1500, 0
if ktrig == 1 then
event "i", 5202, 0 , 1, itab
turnoff
endif
ithresh = p3 - 1
if ktim > ithresh then
gkduck linseg .05, .8, .05, .2, 1
endif
endin
/****************************************************************
Audio input recording
****************************************************************/
instr 5202
kenv adsr 0.005, 0.05, .9, 0.01
gkduck linseg .05, .8, .05, .2, 1
ain inch 1
adel delay ain, .01
Sname sprintf "/home/olpc/.sugar/default/tamtam/mic%d", int(p4)-6
ihandle fiopen Sname, 2
event "i", 5212, 1 , .01, p4
fout Sname, 2, adel*kenv
adel = 0
endin
/****************************************************************
Audio input recording ( closing file )
****************************************************************/
instr 5212
Sname sprintf "/home/olpc/.sugar/default/tamtam/mic%d", int(p4)-6
ficlose Sname
endin
/****************************************************************
SynthLab input recording
****************************************************************/
instr 5204
Sname2 sprintf "/home/olpc/.sugar/default/tamtam/lab%d", int(p4)-85
fout Sname2, 2, gasynth*4
clear gasynth
endin
/************************
TamTam's SynthLab instrument
************************/
instr 5203
if p5 != 0 then
event_i "i", 5204, 0, 4, p5
endif
aSource1 init 0
aSource2 init 0
aSource3 init 0
aSource4 init 0
aFx1 init 0
aFx2 init 0
aFx3 init 0
aFx4 init 0
aout init 0
ipitch = p4
kc1 control 1,p3
kc2 control 2,p3
kc3 control 3,p3
kc4 control 4,p3
is1p1 ControlMatrice 5201, 0, kc1, kc2, kc3, kc4
is1p2 ControlMatrice 5201, 1, kc1, kc2, kc3, kc4
is1p3 ControlMatrice 5201, 2, kc1, kc2, kc3, kc4
is1p4 ControlMatrice 5201, 3, kc1, kc2, kc3, kc4
is2p1 ControlMatrice 5201, 4, kc1, kc2, kc3, kc4
is2p2 ControlMatrice 5201, 5, kc1, kc2, kc3, kc4
is2p3 ControlMatrice 5201, 6, kc1, kc2, kc3, kc4
is2p4 ControlMatrice 5201, 7, kc1, kc2, kc3, kc4
is3p1 ControlMatrice 5201, 8, kc1, kc2, kc3, kc4
is3p2 ControlMatrice 5201, 9, kc1, kc2, kc3, kc4
is3p3 ControlMatrice 5201, 10, kc1, kc2, kc3, kc4
is3p4 ControlMatrice 5201, 11, kc1, kc2, kc3, kc4
is4p1 ControlMatrice 5201, 12, kc1, kc2, kc3, kc4
is4p2 ControlMatrice 5201, 13, kc1, kc2, kc3, kc4
is4p3 ControlMatrice 5201, 14, kc1, kc2, kc3, kc4
is4p4 ControlMatrice 5201, 15, kc1, kc2, kc3, kc4
aSource1 source 1, ipitch*2
aSource2 source 2, ipitch*2
aSource3 source 3, ipitch*2
aSource4 source 4, ipitch*2
ifx1p1 ControlMatrice 5202, 0, kc1, kc2, kc3, kc4
ifx1p2 ControlMatrice 5202, 1, kc1, kc2, kc3, kc4
ifx1p3 ControlMatrice 5202, 2, kc1, kc2, kc3, kc4
ifx1p4 ControlMatrice 5202, 3, kc1, kc2, kc3, kc4
ifx2p1 ControlMatrice 5202, 4, kc1, kc2, kc3, kc4
ifx2p2 ControlMatrice 5202, 5, kc1, kc2, kc3, kc4
ifx2p3 ControlMatrice 5202, 6, kc1, kc2, kc3, kc4
ifx2p4 ControlMatrice 5202, 7, kc1, kc2, kc3, kc4
ifx3p1 ControlMatrice 5202, 8, kc1, kc2, kc3, kc4
ifx3p2 ControlMatrice 5202, 9, kc1, kc2, kc3, kc4
ifx3p3 ControlMatrice 5202, 10, kc1, kc2, kc3, kc4
ifx3p4 ControlMatrice 5202, 11, kc1, kc2, kc3, kc4
ifx4p1 ControlMatrice 5202, 12, kc1, kc2, kc3, kc4
ifx4p2 ControlMatrice 5202, 13, kc1, kc2, kc3, kc4
ifx4p3 ControlMatrice 5202, 14, kc1, kc2, kc3, kc4
ifx4p4 ControlMatrice 5202, 15, kc1, kc2, kc3, kc4
ifx1in SourceMatrice 1, aSource1, aSource2, aSource3, aSource4
ifx2in SourceMatrice 2, aSource1, aSource2, aSource3, aSource4
ifx3in SourceMatrice 3, aSource1, aSource2, aSource3, aSource4
ifx4in SourceMatrice 4, aSource1, aSource2, aSource3, aSource4
ifx1in1 FxMatrice 5, aFx1, aFx2, aFx3, aFx4
ifx2in1 FxMatrice 6, aFx1, aFx2, aFx3, aFx4
ifx3in1 FxMatrice 7, aFx1, aFx2, aFx3, aFx4
ifx4in1 FxMatrice 8, aFx1, aFx2, aFx3, aFx4
aFx1 effects 1, ipitch
aFx2 effects 2, ipitch
aFx3 effects 3, ipitch
aFx4 effects 4, ipitch
iSourceOut1 table 8, 5206
iSourceOut2 table 9, 5206
iSourceOut3 table 10, 5206
iSourceOut4 table 11, 5206
iFxOut1 table 12, 5206
iFxOut2 table 13, 5206
iFxOut3 table 14, 5206
iFxOut4 table 15, 5206
aout = (aSource1*iSourceOut1)+(aSource2*iSourceOut2)+(aSource3*iSourceOut3)+(aSource4*iSourceOut4)+(aFx1*iFxOut1)+(aFx2*iFxOut2)+(aFx3*iFxOut3)+(aFx4*iFxOut4)
kenv adsr p3*p6+0.001, p3*p7, p8, p3*p9
aout = aout*kenv
vincr gasynth, aout
outs aout, aout
zacl 0, 8
endin
/****************************************************************
Soundfile player with tied notes
****************************************************************/
instr 5999
/* gkptime times */
gkrtime rtclock
/* giptime times */
girtime rtclock
endin
/*************************
pitch, reverbGain, amp, pan, table, att, dec, filtType, cutoff, loopstart, loopend, crossdur
*************************/
instr 5001
idurfadein init 0.005
idurfadeout init 0.095
iampe0 init 1
iampe1 = p6
iampe2 init 1
itie tival
if itie == 1 igoto nofadein
idurfadein init p9
iampe0 init 0
iskip = 1
kpitch init p4
kamp init p6
kpan init p7
krg init p5
nofadein:
iskip = 0
igliss = 0.005
if p3 < 0 igoto nofadeout
idurfadeout init p10
iampe2 init 0
nofadeout:
idelta = idurfadein+idurfadeout
if idelta > abs(p3) then
idelta = abs(p3)
endif
iampe0 = iampe0 * p6
iampe2 = iampe2 * p6
kenv linseg iampe0, idurfadein, iampe1, abs(p3)-idelta, iampe1, idurfadeout, iampe2
tigoto tieskip
kpitch portk p4, igliss, p4
kpan portk p7, igliss, p7
krg portk p5, igliss, p5
kcutoff portk p12, igliss, p12
kls portk p13, igliss, p13
kle portk p14, igliss, p14
kcd portk p15, igliss, p15
a1 flooper2 1, kpitch, kls, kle, kcd, p8, 0, 0, 0, iskip
if (p11-1) != -1 then
acomp = a1
a1 bqrez a1, kcutoff, 6, p11-1
a1 balance a1, acomp
endif
a1 = a1*kenv
gaoutL = a1*(1-kpan)+gaoutL
gaoutR = a1*kpan+gaoutR
gainrev = a1*krg+gainrev
tieskip:
endin
/***********************
DELETE RESOURCES
************************/
instr 5000
icount init 0
again:
ftfree 5000+icount, 0
icount = icount+1
if icount < p4 goto again
turnoff
endin
/********************************************************************
soundfile player for percussion - resonance notes
********************************************************************/
instr 5002
a1 flooper2 1, p4, .25, .750, .2, p8
if (p11-1) != -1 then
acomp = a1
a1 bqrez a1, p12, 6, p11-1
a1 balance a1, acomp
endif
kenv expseg 0.001, .003, .6, p3 - .003, 0.001
klocalenv adsr p8, 0.05, .8, p10
a1 = a1*kenv*klocalenv
gaoutL = a1*(1-p7)+gaoutL
gaoutR = a1*p7+gaoutR
gainrev = a1*p5+gainrev
endin
/**************************************************************
Simple soundfile player
**************************************************************/
instr 5777
/*iptime = i(gkptime) */
irtime = i(gkrtime)
/*icurptime = iptime - giptime */
/*icurlag = irtime - iptime - (girtime - giptime) */
i2 = p5 - (irtime - girtime) + 0.1
event_i "i", p4, i2, p6, p7, p8, p9, p10, p11, p12, p13, p14
endin
instr 5003
p3 = nsamp(p8) * giScale / p4
a1 loscil p6, p4, p8, 1
if (p11-1) != -1 then
acomp = a1
a1 bqrez a1, p12, 6, p11-1
a1 balance a1, acomp
endif
kenv adsr p9, 0.05, .8, p10
a1 = a1*kenv
gaoutL = a1*(1-p7)+gaoutL
gaoutR = a1*p7+gaoutR
gainrev = a1*p5+gainrev
endin
</CsInstruments>
<CsScore>
f1 0 8192 10 1
f2 0 8192 11 1 1
f4 0 32 -2 250 2250 2980 420 2050 2630 590 1770 2580
750 1450 2590 290 750 2300 360 770 2530 520 900 2510 710 1230 2700 570 1560 2560 0 0 0 0 0
f40 0 1024 10 1 0 .5 0 0 .3 0 0 .2 0 .1 0 0 0 0 .2 0 0 0 .05 0 0 0 0 .03 ; ADDITIVE SYNTHESIS WAVE
f41 0 8193 19 .5 .5 270 .5 ; SIGMOID FUNCTION
f42 0 8192 -20 2 1
f44 0 8192 5 1 8192 0.001 ; EXPONENTIAL FUNCTION
f5150 0 32768 7 0 32768 0
i200 0 600000
</CsScore>
</CsoundSynthesizer>
|