;Written by Iain McCurdy, 2006
;THE screverb 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 table(s) for exp slider
; 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|-+
; | +----+ |
; + +
; | +----+ |
; +-|comb|-+
; | +----+ | +-------+ +-------+ +-------+ +-------+
; IN-->| |-|allpass|-|allpass|-|allpass|-|allpass|-->OUT
; | +----+ | +-------+ +-------+ +-------+ +-------+
; +-|comb|-+
; | +----+ |
; | |
; | +----+ |
; +-|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)
giExp1 ftgen 0, 0, 129, -25, 0, 20.0, 128, 20000.0 ;TABLE FOR EXP SLIDER
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"
gkfblvl invalue "FBLevel"
kfco invalue "CutFreq"
gkfco tablei kfco, giExp1, 1
outvalue "CutFreq_Value", gkfco
gkpitchm invalue "Modulation"
gkmix invalue "Mix"
gkamp invalue "Amplitude"
gkskip invalue "Init"
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
denorm gasigL, gasigR ;DENORMALIZE BOTH CHANNELS OF AUDIO SIGNAL
kSwitch changed gkpitchm, gkskip ;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 kSwitch=1 THEN
reinit UPDATE ;BEGIN A REINITIALIZATION PASS FROM LABEL 'UPDATE'
endif ;END OF CONDITIONAL BRANCHING
UPDATE: ;A LABEL
arvbL, arvbR reverbsc gasigL, gasigR, gkfblvl, gkfco, sr, i(gkpitchm), i(gkskip)
rireturn ;RETURN TO PERFORMANCE TIME PASSES
amixL ntrpol gasigL, arvbL, gkmix ;CREATE A DRY/WET MIX BETWEEN THE DRY AND THE REVERBERATED SIGNAL
amixR ntrpol gasigR, arvbR, gkmix ;CREATE A DRY/WET MIX BETWEEN THE DRY AND THE REVERBERATED SIGNAL
outs amixL * gkamp, amixR * gkamp
clear gasigL, gasigR ;CLEAR GLOBAL AUDIO VARIABLES
endin
instr 11 ;INIT
outvalue "FBLevel" , 0.7
outvalue "CutFreq" , 0.89965
outvalue "Modulation" , 1.0
outvalue "Mix" , 0.5
outvalue "Amplitude" , 0.6
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
433
293
932
439
true
241
226
185
2
2
512
430
{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
410
430
{74928ed2-b701-4668-9a11-74763d317e9b}
true
0
0
center
Liberation Sans
18
3
0
0
0
158
220
217
border
5
2
519
15
404
414
{d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a}
true
0
0
left
Liberation Sans
14
3
0
0
0
255
255
255
noborder
1
1
Input
201
331
120
30
{9b81a1f2-bcb8-4582-925b-9ae56def3865}
true
0
0
Audio File
0
Live Input
1
0
false
119
331
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
368
170
30
{9b992da1-8c0f-449e-af03-7913cc05efed}
true
0
0
value
1.00000000
808loop.wav
Browse Audio File
/
false
false
_Browse1
180
369
330
28
{15a8ec14-710f-43e6-be9e-f5dc8c8786cb}
true
0
0
left
Arial
10
3
0
0
0
229
229
229
nobackground
180
398
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.13000000
lin
continuous
-1.00000000
false
8
110
120
30
{4fa545c6-e2f1-4387-8c9f-4a9dd388bb42}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
FBLevel
448
110
60
30
{b0ad1916-b43e-44c2-be40-bca29f5cb1f4}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
FBLevel
8
94
500
27
{9069e547-5638-4568-896f-980087c61de0}
true
0
0
0.00000000
1.00000000
0.69999999
lin
continuous
-1.00000000
false
8
149
180
30
{ada34c8d-83fe-4eae-b207-ac7e38c5251f}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
CutFreq_Value
448
149
60
30
{c333f6de-006b-45d6-bfec-c6a0205b39e8}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
CutFreq
8
133
500
27
{07f985ef-961c-4c4a-b40b-ac266b8e938d}
true
0
0
0.00000000
1.00000000
0.89964998
lin
continuous
-1.00000000
false
8
187
172
33
{aea49d35-076f-4f53-973f-218c07658afd}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Modulation
448
187
60
30
{e618dde4-1681-4841-ad6b-2f09a0dc7e42}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
Modulation
8
172
500
27
{d92cf2f2-852e-4c61-ba7a-5211a302ad02}
true
0
0
0.00000000
20.00000000
1.00000000
lin
continuous
-1.00000000
false
Init
201
287
150
30
{06f94b79-d73c-44b8-a647-21b9f1e5537b}
true
0
0
Initialisation On
0
Initialisation Off
1
0
false
8
229
180
30
{8e21ec7d-44b5-4ca0-a463-9ec9285bda81}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Mix
448
229
60
30
{b0ca2f7f-a050-4f1e-a535-c50c41d3e5a1}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
Mix
8
213
500
27
{9800c17d-02ef-45c9-8f67-e4d15970588d}
true
0
0
0.00000000
1.00000000
0.50000000
lin
continuous
-1.00000000
false
8
267
172
33
{29fad642-3ee4-4b23-bb66-1b6c9052c213}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Amplitude
448
267
60
30
{38aca655-2941-45e8-81a4-58dac984ca90}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
Amplitude
8
252
500
27
{82295eff-99d5-4889-ba99-c947a31cef6b}
true
0
0
0.00000000
1.00000000
0.60000002
lin
continuous
-1.00000000
false