;Written by Iain McCurdy, 2010
;Modified for QuteCsound by René, January 2011, updated Feb 2011
;Tested on Ubuntu 10.04 with csound-float 5.13.0 and QuteCsound svn rev 817
;Notes on modifications from original csd:
; Add tables for exp slider
; Add Browser for audio files and use of FilePlay2 udo, now accept mono or stereo wav files
;my flags on Ubuntu: -iadc -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=null -m0
--env:SSDIR+=../../SourceMaterials
sr = 44100 ;SAMPLE RATE
ksmps = 16 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE
nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO)
;TABLES FOR EXP SLIDER
giExp1 ftgen 0, 0, 129, -25, 0, 0.001, 128, 1.0
giExp100 ftgen 0, 0, 129, -25, 0, 0.01, 128, 100.0
giExp32768 ftgen 0, 0, 129, -25, 0, 1.0, 128, 32768.0
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
kthreshold invalue "Threshold"
gkthreshold tablei kthreshold, giExp32768, 1
outvalue "Threshold_Value", gkthreshold
kcomp1 invalue "Compr_Up"
gkcomp1 tablei kcomp1, giExp100, 1
outvalue "Compr_Up_Value", gkcomp1
kcomp2 invalue "Compr_Low"
gkcomp2 tablei kcomp2, giExp100, 1
outvalue "Compr_Low_Value", gkcomp2
krtime invalue "Rise"
gkrtime tablei krtime, giExp1, 1
outvalue "Rise_Value", gkrtime
kftime invalue "Fall"
gkftime tablei kftime, giExp1, 1
outvalue "Fall_Value", gkftime
kgain invalue "Gain"
gkgain tablei kgain, giExp100, 1
outvalue "Gain_Value", gkgain
gkInGain invalue "Live_Gain"
gkinput invalue "Input"
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
if kfile != 0 then ;IF A BANG HAD BEEN GENERATED IN THE LINE ABOVE
reinit NEW_FILE ;REINITIALIZE FROM LABEL 'NEW_FILE'
endif
if gkinput=0 then
aSigL, aSigR ins
aSigL = aSigL*gkInGain
aSigR = aSigR*gkInGain
else
NEW_FILE:
aSigL, aSigR FilePlay2 Sfile, 1, 0, 1
rireturn
endif
ktrig changed gkcomp1, gkcomp2, gkrtime, gkftime
if ktrig=1 then
reinit UPDATE
endif
UPDATE:
aCompL dam aSigL, gkthreshold, i(gkcomp1), i(gkcomp2), i(gkrtime), i(gkftime)
aCompR dam aSigR, gkthreshold, i(gkcomp1), i(gkcomp2), i(gkrtime), i(gkftime)
rireturn
outs aCompL*gkgain, aCompR*gkgain
endin
;INSTR | START | DURATION
i 10 0 3600 ;GUI
546
400
771
362
true
241
226
185
2
2
512
360
{aa607456-d368-4d59-8497-d16d608404c3}
true
0
0
center
Liberation Sans
18
3
0
0
0
147
154
255
border
5
2
8
8
100
30
{24979132-c53f-4414-ac6b-6b4f503ecfe8}
true
0
0
event
1.00000000
On / Off
/
i1 0 -1
true
false
_Browse
10
103
170
30
{b9431a61-61f7-432b-bf6f-c47ddc7f9050}
true
0
0
value
1.00000000
808loop.wav
Browse Audio File
/
false
false
_Browse
181
104
326
28
{68b5f90b-b78e-4581-b434-232db5f4c40f}
true
0
0
left
Liberation Sans
10
3
0
0
0
229
229
229
nobackground
Input
331
61
120
30
{be1f1edc-082e-4433-a418-1e81baf4e305}
true
0
0
Live
0
Audio File
1
1
false
8
78
120
30
{2c897206-0dbc-47b5-ba68-915d83839ab6}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Live_Gain
8
61
300
27
{304e78d8-b320-453a-b28f-86b0ca872b86}
true
0
0
0.00000000
1.00000000
0.30666667
lin
continuous
-1.00000000
false
Live_Gain
248
78
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
156
180
30
{76044785-79c4-4202-b7ce-07aee4868219}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Threshold
8
139
500
27
{0f952e77-ff9b-4621-b1af-23252bb9c2a6}
true
0
0
0.00000000
1.00000000
0.51000000
lin
continuous
-1.00000000
false
Threshold_Value
448
156
60
30
{7b92c0ca-2fe8-4b4f-9ed0-f618c1b3cb5c}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
8
191
200
30
{ca41878c-b561-486b-9cf9-d0da6b48448b}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Compr_Up
8
174
500
27
{2800fb88-347a-402c-88ed-fc97af6a36be}
true
0
0
0.00000000
1.00000000
0.50000000
lin
continuous
-1.00000000
false
Compr_Up_Value
448
191
60
30
{5d1ba94c-536a-4178-be6c-c0d9d2f75e3d}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
8
226
200
30
{cdd71125-b224-471a-9c41-9c05d8d28d0c}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Compr_Low
8
209
500
27
{7a83bb1f-f25d-47e0-bf2d-9c5c86e0756b}
true
0
0
0.00000000
1.00000000
0.50000000
lin
continuous
-1.00000000
false
Compr_Low_Value
448
226
60
30
{7f8d2709-bf8c-46ab-83f0-36fc620b0d56}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
8
261
180
30
{9519d46e-b6e4-422e-8653-ae5db12b1c04}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Rise
8
244
500
27
{0f9b569d-7f5b-4540-a415-6fd6762f6fe9}
true
0
0
0.00000000
1.00000000
0.00000000
lin
continuous
-1.00000000
false
Rise_Value
448
261
60
30
{df4e20a1-b9a6-46ca-bb02-911779f6b4b5}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
8
295
180
30
{1089c148-0c3a-497a-a8d5-a62e3d62ff54}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Fall
8
278
500
27
{cb90b71f-234b-4c3e-875b-ce04075ae3ee}
true
0
0
0.00000000
1.00000000
0.33400000
lin
continuous
-1.00000000
false
Fall_Value
448
295
60
30
{54d08872-94cf-49c9-b64f-605fddc65867}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
8
330
180
30
{8c81bb50-0c7b-4902-9178-d05f83831ade}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Gain
8
313
500
27
{6ef7cd84-2fc3-4cb0-b69d-4d037f7406af}
true
0
0
0.00000000
1.00000000
0.49800000
lin
continuous
-1.00000000
false
Gain_Value
448
330
60
30
{9481489d-99dd-43af-8282-21a31584dd71}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
516
2
255
360
{52d07e03-b10c-4a36-acd5-f2827b3ef558}
true
0
0
center
Liberation Sans
18
3
0
0
0
147
154
255
border
5
2
518
42
250
299
{887f16f8-2d28-4cd6-b66f-977a8c6f840e}
true
0
0
left
Liberation Sans
14
3
0
0
0
255
255
255
noborder
1
1