1 2 3 -+rtaudio=alsa -idevaudio -odevaudio -m0 -W -s -d -b512 -B1024 4 5 6 sr=16000 7 ksmps=100 8 nchnls=2 9 giScale = 1/sr 10 11 gainrev init 0 12 gaoutL init 0 13 gaoutR init 0 14 gasynth init 0 15 gkTrackpadX init 0 16 gkTrackpadY init 0 17 18 /***************************** 19 matrix for TamTam's SynthLab 20 *****************************/ 21 zakinit 8, 32 22 23 /***************************** 24 opcodes needed by TamTam's SynthLab 25 *****************************/ 26 27 opcode synthGrain, a, aaiiii 28 aindex, atrans, ifreq, iphase itable, itabdur xin 29 apha phasor ifreq, iphase 30 aenv tab apha, 42, 1 31 atrig = int(1-aenv) 32 apos samphold aindex, atrig 33 adur samphold atrans, atrig 34 35 aline = apha * adur * sr + apos 36 aline limit aline, 0 , itabdur 37 ag tablei aline, itable, 0 38 aout = ag * aenv 39 40 xout aout 41 endop 42 43 44 opcode ControlMatrice, i, iikkkk 45 iTable, iIndex, kc1, kc2, kc3, kc4 xin 46 47 iSomme table iIndex, iTable+3 48 49 if iSomme == 0 then 50 goto noparams 51 endif 52 53 iPar table iIndex, iTable 54 55 if iSomme == 1 then 56 kp = iPar 57 elseif iSomme == 3 then 58 kp = iPar * kc1 59 elseif iSomme == 5 then 60 kp = iPar * kc2 61 elseif iSomme == 7 then 62 kp = iPar * ((kc1 + kc2)*.5) 63 elseif iSomme == 9 then 64 kp = iPar * kc3 65 elseif iSomme == 11 then 66 kp = iPar * ((kc1 + kc3)*.5) 67 elseif iSomme == 13 then 68 kp = iPar * ((kc2 + kc3)*.5) 69 elseif iSomme == 15 then 70 kp = iPar * ((kc1 + kc2 + kc3)*.33) 71 elseif iSomme == 17 then 72 kp = iPar * kc4 73 elseif iSomme == 19 then 74 kp = iPar * ((kc1 + kc4)*.5) 75 elseif iSomme == 21 then 76 kp = iPar * ((kc2 + kc4)*.5) 77 elseif iSomme == 23 then 78 kp = iPar * ((kc1 + kc2 + kc4)*.33) 79 elseif iSomme == 25 then 80 kp = iPar * ((kc3 + kc4)*.5) 81 elseif iSomme == 27 then 82 kp = iPar * ((kc1 + kc3 + kc4)*.5) 83 elseif iSomme == 29 then 84 kp = iPar * ((kc2 + kc3 + kc4)*.33) 85 elseif iSomme == 31 then 86 kp = iPar * ((kc1 + kc2 + kc3 + kc4)*.25) 87 endif 88 89 if iTable == 5201 then 90 zkw kp, iIndex+1 91 elseif iTable == 5202 then 92 zkw kp, iIndex+17 93 endif 94 95 xout iIndex 96 97 noparams: 98 endop 99 100 opcode SourceMatrice, i, iaaaa 101 iIndex, as1, as2, as3, as4 xin 102 103 iSomme table iIndex-1, 5206 104 105 if iSomme == 0 then 106 goto noparams 107 endif 108 109 if iSomme == 1 then 110 as = as1 111 elseif iSomme == 2 then 112 as = as2 113 elseif iSomme == 3 then 114 as = as1 + as2 115 elseif iSomme == 4 then 116 as = as3 117 elseif iSomme == 5 then 118 as = as1 + as3 119 elseif iSomme == 6 then 120 as = as2 + as3 121 elseif iSomme == 7 then 122 as = as1 + as2 + as3 123 elseif iSomme == 8 then 124 as = as4 125 elseif iSomme == 9 then 126 as = as1 + as4 127 elseif iSomme == 10 then 128 as = as2 + as4 129 elseif iSomme == 11 then 130 as = as1 + as2 + as4 131 elseif iSomme == 12 then 132 as = as3 + as4 133 elseif iSomme == 13 then 134 as = as1 + as3 + as4 135 elseif iSomme == 14 then 136 as = as2 + as3 + as4 137 elseif iSomme == 15 then 138 as = as1 + as2 + as3 + as4 139 endif 140 141 zaw as, iIndex 142 xout iIndex 143 144 noparams: 145 endop 146 147 opcode FxMatrice, i, iaaaa 148 iIndex, as1, as2, as3, as4 xin 149 150 iSomme table iIndex-1, 5206 151 152 if iSomme == 0 then 153 goto noparams 154 endif 155 156 if iSomme == 1 then 157 as = as1 158 elseif iSomme == 2 then 159 as = as2 160 elseif iSomme == 3 then 161 as = as1 + as2 162 elseif iSomme == 4 then 163 as = as3 164 elseif iSomme == 5 then 165 as = as1 + as3 166 elseif iSomme == 6 then 167 as = as2 + as3 168 elseif iSomme == 7 then 169 as = as1 + as2 + as3 170 elseif iSomme == 8 then 171 as = as4 172 elseif iSomme == 9 then 173 as = as1 + as4 174 elseif iSomme == 10 then 175 as = as2 + as4 176 elseif iSomme == 11 then 177 as = as1 + as2 + as4 178 elseif iSomme == 12 then 179 as = as3 + as4 180 elseif iSomme == 13 then 181 as = as1 + as3 + as4 182 elseif iSomme == 14 then 183 as = as2 + as3 + as4 184 endif 185 186 zaw as, iIndex 187 xout iIndex 188 189 noparams: 190 endop 191 192 opcode control, k, ii 193 iControlNum, idur xin 194 195 iControlType table iControlNum-1, 5203 196 197 if iControlType == 0 then 198 goto nocontrol 199 endif 200 201 ioffset = (iControlNum-1)*4 202 iPar1 table ioffset, 5200 203 iPar2 table ioffset+1, 5200 204 iPar3 table ioffset+2, 5200 205 iPar4 table ioffset+3, 5200 206 207 if iControlType == 1 then 208 kControl lfo iPar1, iPar2, int(iPar3) 209 kControl = kControl+iPar4 210 elseif iControlType == 2 then 211 irange = (iPar2-iPar1)*.5 212 kControl randi irange, iPar3, iPar4-.001, 0, irange+iPar1 213 elseif iControlType == 3 then 214 kControl adsr iPar1*idur+.0001, iPar2*idur, iPar3, iPar4*idur 215 elseif iControlType == 4 then 216 if iPar3 == 0 then 217 kControl1 = ((gkTrackpadX+1)*.5)*(iPar2-iPar1)+iPar1 218 elseif iPar3 == 1 then 219 kval = (gkTrackpadX+1)*.5 220 kControl1 pow kval, 2 221 kControl1 = kControl1 * (iPar2-iPar1) + iPar1 222 endif 223 if iPar4 == 0 then 224 kControl = kControl1 225 else 226 ktrig oscil 1, 1/iPar4, 45 227 kControl samphold kControl1, ktrig, i(kControl1), 0 228 endif 229 elseif iControlType == 5 then 230 if iPar3 == 0 then 231 kControl1 = ((gkTrackpadY+1)*.5)*(iPar2-iPar1)+iPar1 232 elseif iPar3 == 1 then 233 kval = (gkTrackpadY+1)*.5 234 kControl1 pow kval, 2 235 kControl1 = kControl1 * (iPar2-iPar1) + iPar1 236 endif 237 if iPar4 == 0 then 238 kControl = kControl1 239 else 240 ktrig oscil 1, 1/iPar4, 45 241 kControl samphold kControl1, ktrig, i(kControl1), 0 242 endif 243 endif 244 245 xout kControl 246 247 nocontrol: 248 endop 249 250 opcode source, a, ii 251 iSourceNum, ipitch xin 252 253 iSourceType table iSourceNum+3, 5203 254 255 if iSourceType == 0 then 256 goto nosource 257 endif 258 259 ioffset = (iSourceNum-1)*4 260 kpara1 zkr ioffset+1 261 kpara2 zkr ioffset+2 262 kpara3 zkr ioffset+3 263 kpara4 zkr ioffset+4 264 265 iPar1 table ioffset, 5201 266 iPar2 table ioffset+1, 5201 267 iPar3 table ioffset+2, 5201 268 iPar4 table ioffset+3, 5201 269 270 if iSourceType == 1 then 271 aSource foscil 2000*kpara4, ipitch, kpara1, kpara2, kpara3, 1 272 elseif iSourceType == 2 then 273 aSource gbuzz 5000*kpara4, ipitch*kpara1, int(abs(kpara2))+5, 0, kpara3+0.01, 2 274 elseif iSourceType == 3 then 275 iPar2 = int(iPar2) 276 if iPar2 == 0 then 277 imode = 0 278 elseif iPar2 == 1 then 279 imode = 10 280 elseif iPar2 == 2 then 281 imode = 12 282 endif 283 aSource vco2 2000*kpara4, ipitch*kpara1, imode, 0.1, 0, iPar3 284 elseif iSourceType == 4 then 285 if iPar3 == 0 then 286 kvib = 0 287 goto novib 288 else 289 kvibenv linseg 0, .3, 1, p3-.3, 1 290 kvib oscil ipitch*.015, kpara3, 1 291 endif 292 novib: 293 aSource pluck 5000*kpara4, ipitch*(abs(kpara1))+.001+kvib, 40, 0, 6 294 aSource butterlp aSource, kpara2 295 elseif iSourceType == 5 then 296 if int(iPar1) == 0 then 297 ar rand 5000*kpara4 298 elseif int(iPar1) == 1 then 299 ar pinkish 5000*kpara4 300 elseif int(iPar1) == 2 then 301 ar gauss 5000*kpara4 302 endif 303 knoisebandwith limit abs(kpara3), 1, sr/2 304 aSource butterbp ar, kpara2, knoisebandwith 305 aSource balance aSource, ar 306 elseif iSourceType == 6 then 307 iSndpitch = p4/261.626 308 iLoopIndex = iPar2 * 3 309 ils table iLoopIndex, 5755 310 ile table iLoopIndex+1, 5755 311 icd table iLoopIndex+2, 5755 312 if ile == 0 then 313 ile = nsamp(5000+iPar2) * giScale - .01 314 endif 315 if icd == 0 then 316 icd = .01 317 endif 318 aSource flooper2 kpara4*.4, iSndpitch*abs(kpara1), ils, ile, icd, 5000+iPar2 319 aSource butterlp aSource, abs(kpara3) 320 elseif iSourceType == 7 then 321 kvoy = int(kpara2*3) 322 kform1 table kvoy, 4 323 kform2 table kvoy+1, 4 324 kform3 table kvoy+2, 4 325 kform1 port kform1, .1, 500 326 kform2 port kform2, .1, 1500 327 kform3 port kform3, .1, 2500 328 kvibadev randomi -.0852, .0152, .5 329 kvibfdev randomi -.032, .032, .5 330 kvibfreqrand randomi kpara3-.75, kpara3+.75, .2 331 kvibfatt linseg 0, .3, 1, p3-.3, 1 332 kvib oscili (1+kvibadev)*kvibfatt, (kvibfreqrand+kvibfdev), 1 333 kharm randomi 40, 50, 1.34 334 kmul randomi .80, .84, 1.45 335 kbam randomi 480., 510., 2.07 336 kfunddev randomi -.0053, .0052, 1.05 337 ar gbuzz kbam, (p4*kpara1*(1+kfunddev)+kvib), int(kharm), 0, kmul, 2 338 a1 resonx ar, kform1, 140, 2, 1 339 a2 resonx ar, kform2, 180, 2, 1 340 a3 resonx ar, kform3, 220, 2 , 1 341 aSource = ((a1*80)+(a2*55)+(a3*40))*kpara4 342 elseif iSourceType == 8 then 343 iSndPitch = p4/261.626 344 igrdur = .1 345 itable = 5000+iPar2 346 irealTable = 5500 + iSourceNum 347 itabdur = nsamp(itable) 348 ifreq = 1 / igrdur 349 kamp = kpara4 * .2 350 aindex upsamp abs(kpara3) * itabdur 351 atrans upsamp kpara1 * igrdur * iSndPitch 352 353 as1 synthGrain aindex, atrans, ifreq, 0.82, irealTable, itabdur 354 as2 synthGrain aindex, atrans, ifreq, .58, irealTable, itabdur 355 as3 synthGrain aindex, atrans, ifreq, .41, irealTable, itabdur 356 as4 synthGrain aindex, atrans, ifreq, 0.19, irealTable, itabdur 357 as5 synthGrain aindex, atrans, ifreq, 0, irealTable, itabdur 358 aSource = (as1+as2+as3+as4+as5)*kamp 359 aSource butterlp aSource, 7500 360 361 endif 362 363 aSource dcblock aSource 364 xout aSource 365 366 nosource: 367 endop 368 369 opcode effects, a, ii 370 iFxNum, ipitch xin 371 372 iFxType table iFxNum+7, 5203 373 374 if iFxType == 0 then 375 goto nofx 376 endif 377 378 as1 zar iFxNum 379 as2 zar iFxNum+4 380 as = as1+as2 381 382 ioffset = (iFxNum+3)*4 383 kpara1 zkr ioffset+1 384 kpara2 zkr ioffset+2 385 kpara3 zkr ioffset+3 386 kpara4 zkr ioffset+4 387 388 ioffset2 = (iFxNum-1)*4 389 iPar1 table ioffset2, 5202 390 iPar2 table ioffset2+1, 5202 391 iPar3 table ioffset2+2, 5202 392 iPar4 table ioffset2+3, 5202 393 394 if iFxType == 1 then 395 kwgfeed limit kpara3, 0, 1 396 aFx wguide1 as, abs(kpara1)+1, kpara2, kwgfeed 397 aFx = aFx*kpara4 398 elseif iFxType == 2 then 399 aFx lpf18 as*.0005, abs(kpara1)+20, kpara2, kpara3 400 aFx = aFx*5000*kpara4 401 elseif iFxType == 3 then 402 aFx bqrez as*kpara4, abs(kpara1)+20, abs(kpara2)+1, int(iPar3) 403 aFx balance aFx, as*kpara4 404 elseif iFxType == 4 then 405 amod lfo 1, kpara1, int(iPar3) 406 aFx = ((as*amod*kpara2)+(as*(1-kpara2)))*kpara4 407 elseif iFxType == 5 then 408 ain = as*kpara4 409 krevLength limit kpara1, 0.01, 10 410 arev reverb ain, krevLength 411 arev butterlp arev, kpara2 412 aFx = (arev*kpara3)+(as*(1-kpara3)) 413 elseif iFxType == 6 then 414 fsig pvsanal as, 1024, 256, 1024, 1 415 ftps1 pvscale fsig, kpara1 416 aFx pvsynth ftps1 417 adry delay as, iPar2 418 aFx = ((aFx*kpara3)+(adry*(1-kpara3)))*kpara4 419 endif 420 421 xout aFx 422 423 nofx: 424 endop 425 426 427 /**************************************************************** 428 Reverb + master out 429 *****************************************************************/ 430 instr 200 431 432 gktime timek 433 434 kTrackpadX chnget "trackpadX" 435 gkTrackpadX = kTrackpadX / 600. 436 gkTrackpadX limit gkTrackpadX, -1, 1 437 438 kTrackpadY chnget "trackpadY" 439 gkTrackpadY = kTrackpadY / 450. 440 gkTrackpadY limit -gkTrackpadY, -1, 1 441 442 koutGain chnget "masterVolume" 443 koutGain = koutGain * 0.01 444 gkduck init 1 445 gkduck port gkduck, .03, 1. 446 447 ain dcblock gainrev*0.05 448 arev reverb ain, 2.5 449 arev butterlp arev, 5000 450 451 aLeft butterlp gaoutL, 7500 452 aRight butterlp gaoutR, 7500 453 outs (arev + aLeft)*koutGain*gkduck, (arev + aRight) * koutGain*gkduck 454 455 gaoutL = 0 456 gaoutR = 0 457 gainrev = 0 458 459 endin 460 461 /**************************************************************** 462 Handler audio input recording 463 ****************************************************************/ 464 instr 5201 465 466 ktim timeinsts 467 468 gkduck = .05 469 itab = p4 470 ain inch 1 471 krms rms ain 472 ktrig trigger krms, 1500, 0 473 474 if ktrig == 1 then 475 event "i", 5202, 0 , 1, itab 476 turnoff 477 endif 478 479 ithresh = p3 - 1 480 481 if ktim > ithresh then 482 gkduck linseg .05, .8, .05, .2, 1 483 endif 484 485 endin 486 487 /**************************************************************** 488 Audio input recording 489 ****************************************************************/ 490 instr 5202 491 kenv adsr 0.005, 0.05, .9, 0.01 492 gkduck linseg .05, .8, .05, .2, 1 493 ain inch 1 494 495 adel delay ain, .01 496 497 Sname sprintf "/home/olpc/.sugar/default/tamtam/mic%d", int(p4)-6 498 ihandle fiopen Sname, 2 499 event "i", 5212, 1 , .01, p4 500 501 fout Sname, 2, adel*kenv 502 adel = 0 503 endin 504 505 /**************************************************************** 506 Audio input recording ( closing file ) 507 ****************************************************************/ 508 instr 5212 509 Sname sprintf "/home/olpc/.sugar/default/tamtam/mic%d", int(p4)-6 510 ficlose Sname 511 endin 512 513 /**************************************************************** 514 SynthLab input recording 515 ****************************************************************/ 516 instr 5204 517 518 Sname2 sprintf "/home/olpc/.sugar/default/tamtam/lab%d", int(p4)-85 519 fout Sname2, 2, gasynth*4 520 clear gasynth 521 endin 522 523 /************************ 524 TamTam's SynthLab instrument 525 ************************/ 526 instr 5203 527 528 if p5 != 0 then 529 event_i "i", 5204, 0, 4, p5 530 endif 531 532 aSource1 init 0 533 aSource2 init 0 534 aSource3 init 0 535 aSource4 init 0 536 aFx1 init 0 537 aFx2 init 0 538 aFx3 init 0 539 aFx4 init 0 540 aout init 0 541 542 ipitch = p4 543 544 kc1 control 1,p3 545 kc2 control 2,p3 546 kc3 control 3,p3 547 kc4 control 4,p3 548 549 is1p1 ControlMatrice 5201, 0, kc1, kc2, kc3, kc4 550 is1p2 ControlMatrice 5201, 1, kc1, kc2, kc3, kc4 551 is1p3 ControlMatrice 5201, 2, kc1, kc2, kc3, kc4 552 is1p4 ControlMatrice 5201, 3, kc1, kc2, kc3, kc4 553 is2p1 ControlMatrice 5201, 4, kc1, kc2, kc3, kc4 554 is2p2 ControlMatrice 5201, 5, kc1, kc2, kc3, kc4 555 is2p3 ControlMatrice 5201, 6, kc1, kc2, kc3, kc4 556 is2p4 ControlMatrice 5201, 7, kc1, kc2, kc3, kc4 557 is3p1 ControlMatrice 5201, 8, kc1, kc2, kc3, kc4 558 is3p2 ControlMatrice 5201, 9, kc1, kc2, kc3, kc4 559 is3p3 ControlMatrice 5201, 10, kc1, kc2, kc3, kc4 560 is3p4 ControlMatrice 5201, 11, kc1, kc2, kc3, kc4 561 is4p1 ControlMatrice 5201, 12, kc1, kc2, kc3, kc4 562 is4p2 ControlMatrice 5201, 13, kc1, kc2, kc3, kc4 563 is4p3 ControlMatrice 5201, 14, kc1, kc2, kc3, kc4 564 is4p4 ControlMatrice 5201, 15, kc1, kc2, kc3, kc4 565 566 aSource1 source 1, ipitch*2 567 aSource2 source 2, ipitch*2 568 aSource3 source 3, ipitch*2 569 aSource4 source 4, ipitch*2 570 571 ifx1p1 ControlMatrice 5202, 0, kc1, kc2, kc3, kc4 572 ifx1p2 ControlMatrice 5202, 1, kc1, kc2, kc3, kc4 573 ifx1p3 ControlMatrice 5202, 2, kc1, kc2, kc3, kc4 574 ifx1p4 ControlMatrice 5202, 3, kc1, kc2, kc3, kc4 575 ifx2p1 ControlMatrice 5202, 4, kc1, kc2, kc3, kc4 576 ifx2p2 ControlMatrice 5202, 5, kc1, kc2, kc3, kc4 577 ifx2p3 ControlMatrice 5202, 6, kc1, kc2, kc3, kc4 578 ifx2p4 ControlMatrice 5202, 7, kc1, kc2, kc3, kc4 579 ifx3p1 ControlMatrice 5202, 8, kc1, kc2, kc3, kc4 580 ifx3p2 ControlMatrice 5202, 9, kc1, kc2, kc3, kc4 581 ifx3p3 ControlMatrice 5202, 10, kc1, kc2, kc3, kc4 582 ifx3p4 ControlMatrice 5202, 11, kc1, kc2, kc3, kc4 583 ifx4p1 ControlMatrice 5202, 12, kc1, kc2, kc3, kc4 584 ifx4p2 ControlMatrice 5202, 13, kc1, kc2, kc3, kc4 585 ifx4p3 ControlMatrice 5202, 14, kc1, kc2, kc3, kc4 586 ifx4p4 ControlMatrice 5202, 15, kc1, kc2, kc3, kc4 587 588 ifx1in SourceMatrice 1, aSource1, aSource2, aSource3, aSource4 589 ifx2in SourceMatrice 2, aSource1, aSource2, aSource3, aSource4 590 ifx3in SourceMatrice 3, aSource1, aSource2, aSource3, aSource4 591 ifx4in SourceMatrice 4, aSource1, aSource2, aSource3, aSource4 592 593 ifx1in1 FxMatrice 5, aFx1, aFx2, aFx3, aFx4 594 ifx2in1 FxMatrice 6, aFx1, aFx2, aFx3, aFx4 595 ifx3in1 FxMatrice 7, aFx1, aFx2, aFx3, aFx4 596 ifx4in1 FxMatrice 8, aFx1, aFx2, aFx3, aFx4 597 598 aFx1 effects 1, ipitch 599 aFx2 effects 2, ipitch 600 aFx3 effects 3, ipitch 601 aFx4 effects 4, ipitch 602 603 iSourceOut1 table 8, 5206 604 iSourceOut2 table 9, 5206 605 iSourceOut3 table 10, 5206 606 iSourceOut4 table 11, 5206 607 iFxOut1 table 12, 5206 608 iFxOut2 table 13, 5206 609 iFxOut3 table 14, 5206 610 iFxOut4 table 15, 5206 611 612 aout = (aSource1*iSourceOut1)+(aSource2*iSourceOut2)+(aSource3*iSourceOut3)+(aSource4*iSourceOut4)+(aFx1*iFxOut1)+(aFx2*iFxOut2)+(aFx3*iFxOut3)+(aFx4*iFxOut4) 613 614 kenv adsr p3*p6+0.001, p3*p7, p8, p3*p9 615 aout = aout*kenv 616 617 vincr gasynth, aout 618 619 outs aout, aout 620 621 zacl 0, 8 622 623 endin 624 625 /**************************************************************** 626 Soundfile player with tied notes 627 ****************************************************************/ 628 instr 5999 629 630 /* gkptime times */ 631 gkrtime rtclock 632 /* giptime times */ 633 girtime rtclock 634 635 endin 636 /************************* 637 pitch, reverbGain, amp, pan, table, att, dec, filtType, cutoff, loopstart, loopend, crossdur 638 *************************/ 639 instr 5001 640 641 idurfadein init 0.005 642 idurfadeout init 0.095 643 iampe0 init 1 644 iampe1 = p6 645 iampe2 init 1 646 647 itie tival 648 if itie == 1 igoto nofadein 649 650 idurfadein init p9 651 iampe0 init 0 652 iskip = 1 653 kpitch init p4 654 kamp init p6 655 kpan init p7 656 krg init p5 657 658 nofadein: 659 iskip = 0 660 igliss = 0.005 661 662 if p3 < 0 igoto nofadeout 663 664 idurfadeout init p10 665 iampe2 init 0 666 667 nofadeout: 668 669 idelta = idurfadein+idurfadeout 670 if idelta > abs(p3) then 671 idelta = abs(p3) 672 endif 673 674 iampe0 = iampe0 * p6 675 iampe2 = iampe2 * p6 676 kenv linseg iampe0, idurfadein, iampe1, abs(p3)-idelta, iampe1, idurfadeout, iampe2 677 678 tigoto tieskip 679 680 kpitch portk p4, igliss, p4 681 kpan portk p7, igliss, p7 682 krg portk p5, igliss, p5 683 kcutoff portk p12, igliss, p12 684 kls portk p13, igliss, p13 685 kle portk p14, igliss, p14 686 kcd portk p15, igliss, p15 687 688 kpitchBend port gkTrackpadX, .03 689 kampBend port gkTrackpadY, .03 690 691 a1 flooper2 1*(1+kampBend), kpitch*(1+kpitchBend), kls, kle, kcd, p8, 0, 0, 0, iskip 692 693 if (p11-1) != -1 then 694 acomp = a1 695 a1 bqrez a1, kcutoff, 6, p11-1 696 a1 balance a1, acomp 697 endif 698 699 a1 = a1*kenv 700 701 gaoutL = a1*(1-kpan)+gaoutL 702 gaoutR = a1*kpan+gaoutR 703 704 gainrev = a1*krg+gainrev 705 706 tieskip: 707 endin 708 709 /*********************** 710 DELETE RESOURCES 711 ************************/ 712 713 instr 5000 714 715 icount init 0 716 717 again: 718 ftfree 5000+icount, 0 719 icount = icount+1 720 721 if icount < p4 goto again 722 723 turnoff 724 725 endin 726 727 /******************************************************************** 728 soundfile player for percussion - resonance notes 729 ********************************************************************/ 730 instr 5002 731 732 a1 flooper2 1, p4, .25, .750, .2, p8 733 734 if (p11-1) != -1 then 735 acomp = a1 736 a1 bqrez a1, p12, 6, p11-1 737 a1 balance a1, acomp 738 endif 739 740 kenv expseg 0.001, .003, .6, p3 - .003, 0.001 741 klocalenv adsr p8, 0.05, .8, p10 742 743 a1 = a1*kenv*klocalenv 744 745 gaoutL = a1*(1-p7)+gaoutL 746 gaoutR = a1*p7+gaoutR 747 748 gainrev = a1*p5+gainrev 749 750 endin 751 752 /************************************************************** 753 Simple soundfile player 754 **************************************************************/ 755 756 instr 5777 757 758 /*iptime = i(gkptime) */ 759 irtime = i(gkrtime) 760 /*icurptime = iptime - giptime */ 761 /*icurlag = irtime - iptime - (girtime - giptime) */ 762 i2 = p5 - (irtime - girtime) + 0.1 763 764 event_i "i", p4, i2, p6, p7, p8, p9, p10, p11, p12, p13, p14 765 766 endin 767 768 instr 5003 769 770 p3 = nsamp(p8) * giScale / p4 771 772 a1 loscil p6, p4, p8, 1 773 774 if (p11-1) != -1 then 775 acomp = a1 776 a1 bqrez a1, p12, 6, p11-1 777 a1 balance a1, acomp 778 endif 779 780 kenv adsr p9, 0.05, .8, p10 781 782 a1 = a1*kenv 783 784 gaoutL = a1*(1-p7)+gaoutL 785 gaoutR = a1*p7+gaoutR 786 787 gainrev = a1*p5+gainrev 788 789 endin 790 791 792 793 f1 0 8192 10 1 794 f2 0 8192 11 1 1 795 796 f4 0 32 -2 250 2250 2980 420 2050 2630 590 1770 2580 797 750 1450 2590 290 750 2300 360 770 2530 520 900 2510 710 1230 2700 570 1560 2560 0 0 0 0 0 798 799 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 800 f41 0 8193 19 .5 .5 270 .5 ; SIGMOID FUNCTION 801 f42 0 8192 -20 2 1 802 f44 0 8192 5 1 8192 0.001 ; EXPONENTIAL FUNCTION 803 f45 0 512 7 0 500 0 2 1 10 1 804 f5150 0 32768 7 0 32768 0 805 i200 0 600000 806 807