;Written by Iain McCurdy, 2006 ;Modified for QuteCsound by René, April 2011 ;Tested on Ubuntu 10.04 with csound-float 5.13.0 and QuteCsound svn rev 817 ;Notes on modifications from original csd: ; Add Browser for audio file ;my flags on Ubuntu: -iadc -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=null -m0 --env:SSDIR+=../../SourceMaterials sr = 44100 ;SAMPLE RATE ksmps = 10 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO) 0dbfs = 1 ;MAXIMUM AMPLITUDE REGARDLESS OF BIT DEPTH instr 10 ;GUI ktrig metro 10 if (ktrig == 1) then ;SLIDERS gkbeg1 invalue "LoopBeg1" gkend1 invalue "LoopEnd1" gkbeg2 invalue "LoopBeg2" gkend2 invalue "LoopEnd2" gkspeed invalue "Speed" gkrelease invalue "Release" gkgain invalue "Gain" ;MENUS gkmode1 invalue "SusLoop" gkmode2 invalue "RelLoop" gklosciltype invalue "OscType" endif endin instr 1 Sfile_new strcpy "" ;INIT TO EMPTY STRING Sfile invalue "_Browse" Sfile_old strcpyk Sfile_new Sfile_new strcpyk Sfile kfile strcmpk Sfile_new, Sfile_old kSwitch changed gkbeg1, gkend1, gkbeg2, gkend2, gkrelease, gkmode1, gkmode2, kfile ;GENERATE A MOMENTARY '1' PULSE IN OUTPUT 'kSwitch' IF ANY OF THE SCANNED INPUT VARIABLES CHANGE. (OUTPUT 'kSwitch' IS NORMALLY ZERO) if kSwitch=1 then ;IF I-RATE VARIABLE CHANGE TRIGGER IS '1'... reinit UPDATE ;BEGIN A REINITIALISATION PASS FROM LABEL 'UPDATE' endif UPDATE: ifn ftgentmp 0, 0, 0, 1, Sfile,0,0,1 ;READ MONO OR STEREO AUDIO FILE CHANNEL 1 ifilelen = nsamp(ifn) ;LENGTH OF THE SAMPLE IN SAMPLES ibeg1 = ifilelen * i(gkbeg1) iend1 = ifilelen * i(gkend1) ibeg2 = ifilelen * i(gkbeg2) iend2 = ifilelen * i(gkend2) aenv linsegr 0, (.01), 1, i(gkrelease), 0 asigloscil loscil aenv, gkspeed, ifn, 1, i(gkmode1), ibeg1, iend1, i(gkmode2), ibeg2, iend2 ;READ GEN01 FUNCTION TABLE USING loscil OPCODE asigloscil3 loscil3 aenv, gkspeed, ifn, 1, i(gkmode1), ibeg1, iend1, i(gkmode2), ibeg2, iend2 ;READ GEN01 FUNCTION TABLE USING loscil3 OPCODE rireturn ;RETURN FROM REINITIALISATION PASS TO PERFORMANCE TIME PASSES if gklosciltype==0 then ;THE NEXT LINE OF CODE CONDITIONALLY EXECUTED IF gklosciltype==0 (GUI MENU) asig = asigloscil ;ASSIGN THE AUDIO SIGNAL asigloscil TO THE AUDIO VARIABLE asig elseif gklosciltype==1 then ;THE NEXT LINE OF CODE CONDITIONALLY EXECUTED IF gklosciltype==1 (GUI MENU) asig = asigloscil3 ;ASSIGN THE AUDIO SIGNAL asigloscil3 TO THE AUDIO VARIABLE asig endif outs asig*gkgain, asig*gkgain endin instr 11 ;INIT outvalue "Speed" , 1.0 outvalue "LoopBeg1" , .37 outvalue "LoopEnd1" , .42 outvalue "RelLoop" , 2 outvalue "LoopBeg2" , .5 outvalue "LoopEnd2" , .55 outvalue "Release" , 10.0 outvalue "Gain" , 0.7 outvalue "OscType" , 0 outvalue "RelLoop" , 2 outvalue "SusLoop" , 1 endin i 10 0 3600 ;GUI i 11 0 0.01 ;INIT 520 256 845 506 true 202 202 202 2 2 512 500 {395a9956-93f5-441f-b0ef-3828f1b2da1c} true 0 0 center Liberation Sans 18 3 0 0 0 181 199 255 border 5 2 8 10 100 26 {0a44e1b8-fab4-40c8-8fa1-f1d1d743c45c} true 0 0 event 1.00000000 On / Off / i 1 0 -1 true false 516 2 323 500 {10e7ae72-c151-4c9d-9f49-e6b1585d8386} true 0 0 center Liberation Sans 18 3 0 0 0 181 199 255 border 5 2 518 18 320 480 {97dfe67c-26c1-4af5-b858-e301d6886c2e} true 0 0 left Liberation Sans 14 3 0 0 0 255 255 255 noborder 1 1 8 157 150 30 {2c897206-0dbc-47b5-ba68-915d83839ab6} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 LoopBeg2 8 140 500 27 {304e78d8-b320-453a-b28f-86b0ca872b86} true 0 0 0.00000000 1.00000000 0.50000000 lin continuous -1.00000000 false LoopBeg2 448 157 60 30 {94c7e961-7981-4d21-942f-80bcc647daf5} true 0 0 right Liberation Sans 9 3 0 0 0 255 255 255 noborder 1 1 8 204 150 30 {0609a258-bba4-43bb-849c-b8709a47f1ba} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 LoopEnd2 8 187 500 27 {49415594-5e61-46ce-b9f8-3adcf2b957c5} true 0 0 0.00000000 1.00000000 0.55000001 lin continuous -1.00000000 false LoopEnd2 448 204 60 30 {6a4ff02e-3d5e-4143-855e-95b4c2614157} true 0 0 right Liberation Sans 9 3 0 0 0 255 255 255 noborder 1 1 8 63 150 30 {feb05e56-b1b1-4494-8c71-ce9e40994fb9} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 LoopBeg1 8 46 500 27 {88f53f0d-44d4-4847-8885-c15e934a8109} true 0 0 0.00000000 1.00000000 0.37000000 lin continuous -1.00000000 false LoopBeg1 448 63 60 30 {dd0574f3-9876-4c0e-b747-f61dee837c94} true 0 0 right Liberation Sans 9 3 0 0 0 255 255 255 noborder 1 1 8 110 150 30 {bf3e8a57-4a8a-4a9d-b67d-9521542ae93d} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 LoopEnd1 8 93 500 27 {8ff8f945-02c5-4ac9-a2e7-f20a8a28a2a5} true 0 0 0.00000000 1.00000000 0.41999999 lin continuous -1.00000000 false LoopEnd1 448 110 60 30 {4b684f89-629e-4f7a-974d-7dd7165f85a7} true 0 0 right Liberation Sans 9 3 0 0 0 255 255 255 noborder 1 1 _Browse 180 459 326 28 {15a8ec14-710f-43e6-be9e-f5dc8c8786cb} true 0 0 left Liberation Sans 10 3 0 0 0 229 229 229 nobackground 8 298 100 30 {e13ea2b5-66c3-4eae-9c6c-91d9e035400b} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 Release 8 281 500 27 {0460f13f-efd6-4403-bc20-c0d21302e628} true 0 0 0.00100000 15.00000000 10.00000000 lin continuous -1.00000000 false Release 448 298 60 30 {7d2a46b9-3d13-4fc4-8081-50dbb35f8ff4} true 0 0 right Liberation Sans 9 3 0 0 0 255 255 255 noborder 1 1 8 251 150 30 {a842add9-35e8-4567-92ab-8061be1c10f7} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 Speed 8 234 500 27 {67d5f50b-6ff1-43e9-90bc-2a4968903ba7} true 0 0 0.00000000 2.00000000 1.00000000 lin continuous -1.00000000 false Speed 448 251 60 30 {8caaf76d-57ae-4684-8b3a-76e073bfd7d0} true 0 0 right Liberation Sans 9 3 0 0 0 255 255 255 noborder 1 1 8 438 100 30 {8de3ea13-9050-4b9d-8b34-9fec61fe4e48} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 _Browse 8 459 170 30 {8c630a69-dc58-46a0-a696-60bc59cec1d6} true 0 0 value 1.00000000 808loopMono.wav Browse Audio File / false false 8 409 100 30 {ed7ec62d-067d-496b-9d76-51fc0bbe0bee} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 Gain 8 392 500 27 {7204111b-1356-4951-96a9-0dd786b34c6b} true 0 0 0.00000000 1.00000000 0.69999999 lin continuous -1.00000000 false Gain 448 409 60 30 {0f7069a0-4c67-4cd1-8c7f-a6dabdc90c23} true 0 0 right Liberation Sans 9 3 0 0 0 255 255 255 noborder 1 1 180 327 100 30 {b57be1dd-771a-4401-af3f-c41b69f33392} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 RelLoop 180 346 150 30 {5f758ab2-3d96-4ae6-b147-e6fa03240962} true 0 0 No Looping 0 Fwd Looping 1 Fwd-Bwd Looping 2 2 false 343 327 100 30 {15137bc2-52c6-4983-82ea-a224c3576267} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 OscType 343 346 150 30 {e9e2c36c-6e52-43fb-9475-8791a4778423} true 0 0 loscil 0 loscil3 1 0 false 16 327 100 30 {fd7776d2-44a3-4a50-9845-38865d795343} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 SusLoop 16 346 150 30 {fb5cadd5-8ae2-48a2-beab-2093685702a0} true 0 0 No Looping 0 Fwd Looping 1 Fwd-Bwd Looping 2 1 false