;Written by Iain McCurdy, 2006 ;THE NREVERB OPCODE IS PLACED IN A SEPARATE, ALWAYS ON, INSTRUMENT FROM THE SOURCE SOUND PRODUCING INSTRUMENT. ;THE IS A COMMONLY USED TECHNIQUE WITH TIME SMEARING OPCODES AND EFFECTS LIKE REVERBS AND DELAYS. ;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 and use of FilePlay2 udo, now accept mono or stereo wav files ; Add init instrument ;Reverb structure: ; +----+ ; +-|comb|-+ ; | +----+ | ; | | ; | +----+ | ; +-|comb|-+ ; | +----+ | ; + + ; | +----+ | ; +-|comb|-+ ; | +----+ | +------+ +------+ +------+ +------+ +------+ ; IN-->| |-|alpass|-|alpass|-|alpass|-|alpass|-|alpass|-->OUT ; | +----+ | +------+ +------+ +------+ +------+ +------+ ; +-|comb|-+ ; | +----+ | ; | | ; | +----+ | ; +-|comb|-+ ; | +----+ | ; | | ; | +----+ | ; +-|comb|-+ ; +----+ ;my flags on Ubuntu: -iadc -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=null -m0 --env:SSDIR+=../../SourceMaterials sr = 44100 ;SAMPLE RATE ksmps = 100 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO) opcode FilePlay2, aa, Skoo ; Credit to Joachim Heintz ;gives stereo output regardless your soundfile is mono or stereo Sfil, kspeed, iskip, iloop xin ichn filenchnls Sfil if ichn == 1 then aL diskin2 Sfil, kspeed, iskip, iloop aR = aL else aL, aR diskin2 Sfil, kspeed, iskip, iloop endif xout aL, aR endop instr 10 ;GUI ktrig metro 10 if (ktrig == 1) then gkingain invalue "LiveGain" gkmix invalue "Mix" gkrvbtime invalue "ReverbTime" gkHFDiff invalue "HFDiffusion" gkinput invalue "Input" endif endin instr 1 ;PLAYS FILE AND OUTPUTS GLOBAL VARIABLES if gkinput==0 then ;IF FILE INPUT IS SELECTED... Sfile invalue "_Browse1" gasigL, gasigR FilePlay2 Sfile, 1, 0, 1 ;GENERATE 2 AUDIO SIGNALS FROM A SOUND FILE (NOTE THE USE OF GLOBAL VARIABLES) else ;OTHERWISE asigL, asigR ins ;TAKE INPUT FROM COMPUTER'S AUDIO INPUT gasigL = asigL * gkingain ;SCALE USING 'Input Gain' SLIDER gasigR = asigR * gkingain ;SCALE USING 'Input Gain' SLIDER endif ;END OF CONDITIONAL BRANCHING endin instr 2 ;REVERB - ALWAYS ON aRvbL nreverb gasigL*.3, gkrvbtime, gkHFDiff ;CREATE LEFT CHANNEL REVERB aRvbR nreverb gasigR*.3, gkrvbtime, gkHFDiff ;CREATE RIGHT CHANNEL REVERB outs (aRvbL * gkmix * .5) + (gasigL * (1 - gkmix)), (aRvbR * gkmix * .5) + (gasigR * (1 - gkmix)) ;MIX SOURCE SIGNAL AND REVERB SIGNAL AT THE OUTPUT AND IMPLEMENT WET/DRY CONTROL USING THE FLTK SLIDER VARIABLE gkmix clear gasigL, gasigR ;CLEAR GLOBAL AUDIO VARIABLES endin instr 11 ;INIT outvalue "Mix" , .5 outvalue "ReverbTime" , .5 outvalue "HFDiffusion" , .5 endin ;INSTR | START | DURATION i 10 0.0 3600 ;GUI i 2 0.0 3600 ;REVERB INSTRUMENT PLAYS FOR 1 HOUR (AND KEEPS PERFORMANCE GOING) i 11 0.0 0.1 ;INIT 73 206 946 318 true 241 226 185 2 2 512 316 {aa607456-d368-4d59-8497-d16d608404c3} true 0 0 center Liberation Sans 18 3 0 0 0 158 220 217 border 5 2 8 10 100 30 {487d5181-d838-4cce-9628-317fefc350cb} true 0 0 event 1.00000000 ON / OFF / i 1 0 -1 true false 8 72 120 30 {0200a063-5db8-4668-bc2d-2d989a083f6e} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 LiveGain 448 72 60 30 {ab191e3a-430d-4f1d-88aa-9840342cd2d3} true 0 0 right Liberation Sans 9 3 0 0 0 255 255 255 noborder 1 1 516 2 430 316 {74928ed2-b701-4668-9a11-74763d317e9b} true 0 0 center Liberation Sans 18 3 0 0 0 158 220 217 border 5 2 519 22 427 293 {d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a} true 0 0 left Liberation Sans 14 3 0 0 0 255 255 255 noborder 1 1 Input 180 215 120 30 {9b81a1f2-bcb8-4582-925b-9ae56def3865} true 0 0 Audio File 0 Live Input 1 0 false 98 215 80 30 {62eeb695-9b83-42da-81cd-8000c232d9b9} true 0 0 right Arial 10 3 0 0 0 255 255 255 noborder 1 1 _Browse1 8 252 170 30 {9b992da1-8c0f-449e-af03-7913cc05efed} true 0 0 value 1.00000000 808loop.wav Browse Audio File / false false _Browse1 180 253 330 28 {15a8ec14-710f-43e6-be9e-f5dc8c8786cb} true 0 0 left Arial 10 3 0 0 0 229 229 229 nobackground 180 282 330 34 {a63909ac-6fa4-41c8-a84b-ba08e76132ab} true 0 0 left Liberation Sans 12 3 0 0 0 255 255 255 noborder 1 1 LiveGain 8 56 500 27 {2a8dc6e2-12f4-443d-af9b-59e4373cc24b} true 0 0 0.00000000 1.00000000 0.22800000 lin continuous -1.00000000 false 8 150 120 30 {4fa545c6-e2f1-4387-8c9f-4a9dd388bb42} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 ReverbTime 448 150 60 30 {b0ad1916-b43e-44c2-be40-bca29f5cb1f4} true 0 0 right Liberation Sans 9 3 0 0 0 255 255 255 noborder 1 1 ReverbTime 8 134 500 27 {9069e547-5638-4568-896f-980087c61de0} true 0 0 0.00100000 20.00000000 0.50000000 lin continuous -1.00000000 false 8 189 180 30 {ada34c8d-83fe-4eae-b207-ac7e38c5251f} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 HFDiffusion 448 189 60 30 {c333f6de-006b-45d6-bfec-c6a0205b39e8} true 0 0 right Liberation Sans 9 3 0 0 0 255 255 255 noborder 1 1 HFDiffusion 8 173 500 27 {07f985ef-961c-4c4a-b40b-ac266b8e938d} true 0 0 0.00000000 1.00000000 0.50000000 lin continuous -1.00000000 false 8 110 172 33 {aea49d35-076f-4f53-973f-218c07658afd} true 0 0 left Liberation Sans 10 3 0 0 0 255 255 255 noborder 1 1 Mix 448 110 60 30 {e618dde4-1681-4841-ad6b-2f09a0dc7e42} true 0 0 right Liberation Sans 9 3 0 0 0 255 255 255 noborder 1 1 Mix 8 95 500 27 {d92cf2f2-852e-4c61-ba7a-5211a302ad02} true 0 0 0.00000000 1.00000000 0.50000000 lin continuous -1.00000000 false