;Written by Iain McCurdy 2011
;Modified for QuteCsound by René, May 2011
;Tested on Ubuntu 10.04 with csound-float (git csound5-3c6d155, May 31 2011) and QuteCsound svn rev 848
;-------> NOT STABLE, freeze QuteCsound
;Notes on modifications from original csd:
; Add table(s) for exp slider
; Add Browser for audio files and use of FilePlay2 udo, now accept mono or stereo wav files
;my flags on Ubuntu: -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=null -m0
--env:SSDIR+=../../SourceMaterials
sr = 44100 ;SAMPLE RATE
ksmps = 32 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE
nchnls = 1 ;NUMBER OF CHANNELS (2=STEREO)
gisine ftgen 0,0,1024,10,1 ;A SINE WAVE (NEEDED FOR THE RESYNTHESIS)
;TABLE FOR EXP SLIDER
giExp1 ftgen 0, 0, 129, -25, 0, 0.125, 128, 4.0
giExp2 ftgen 0, 0, 129, -25, 0, 1.0, 128, 10.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
;COUNTERS
gkmaxtracks invalue "MaxTracks"
gkminpts invalue "MinPoints"
;SLIDERS
gkthresh invalue "Threshold"
gkscal invalue "Scaling"
ktrans invalue "Transp"
gktrans tablei ktrans, giExp1, 1
outvalue "Transp_Value", gktrans
kmaxgap invalue "MaxGap"
gkmaxgap tablei kmaxgap, giExp2, 1
outvalue "MaxGap_Value", gkmaxgap
endif
endin
instr 1
Sfile invalue "_Browse"
asigin,aR FilePlay2 Sfile, 1, 0, 1 ;CREATE AUDIO SIGNAL OF AUDIO SAMPLE TO WHICH STENCILLING WILL BE APPLIED
kporttime linseg 0, 0.001, 0.05 ;A FUNCTION THAT QUICKLY RAMPS UP FROM ZERO THAT WILL BE USED FOR PORTAMENTO TIME
ktrans portk gktrans, kporttime ;PORTAMENTO SMOOTHING APPLIED TO GUI SLIDER PARAMETER
ffr,fphs pvsifd asigin, 1024, 512, 1 ;PVSIFD ANALYSIS
ktrigger changed gkmaxtracks ;IF K-RATE INPUT CHANGES GENERATE AN TRIGGER OUTPUT (MOMENTARY 1)
if ktrigger=1 then ;IF TRIGGER IS '1'...
reinit UPDATE ;BEGIN A REINITIALIZATION PASS FROM LABEL 'UPDATE'
endif ;END OF THE CONDITIONAL BRANCH
UPDATE: ;LABEL 'UPDATE'
ftrks partials ffr, fphs, gkthresh, gkminpts, gkmaxgap, i(gkmaxtracks) ;PARTIAL TRACKING
aout resyn ftrks, gkscal, ktrans, gkmaxtracks, gisine ;RESYNTHESIS
out aout ;SEND THE RESYNTHESIZED SIGNAL TO THE AUDIO OUTPUTS
endin
instr 2 ;INIT
outvalue "Threshold" , 0.003
outvalue "Scaling" , 0.5
outvalue "Transp" , 0.6
outvalue "MaxTracks" , 30
outvalue "MinPoints" , 1
outvalue "MaxGap" , 0.478
endin
;INSTR | START | DURATION
i 10 0 3600 ;GUI
i 2 0 0 ;INIT
74
231
800
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
181
199
255
border
5
2
516
2
284
360
{74928ed2-b701-4668-9a11-74763d317e9b}
true
0
0
center
Liberation Sans
18
3
0
0
0
181
199
255
border
5
2
519
22
278
335
{d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a}
true
0
0
left
Liberation Sans
14
3
0
0
0
255
255
255
noborder
1
1
8
8
100
30
{24979132-c53f-4414-ac6b-6b4f503ecfe8}
true
0
0
event
1.00000000
ON / OFF
/
i 1 0 -1
true
false
Threshold
448
74
60
30
{745d6bee-b951-4a03-9fe8-9e10d5ae4556}
true
0
0
right
Arial
9
3
0
0
0
255
255
255
noborder
1
1
Threshold
8
51
500
27
{06814721-6151-4baa-84e2-8f39843b07a4}
true
0
0
0.00000000
1.00000000
0.00300000
lin
continuous
-1.00000000
false
8
74
180
30
{c6d7165c-6730-426f-b293-52b411bc73cf}
true
0
0
left
Arial
10
3
0
0
0
255
255
255
noborder
1
1
_Browse
8
302
170
30
{b9431a61-61f7-432b-bf6f-c47ddc7f9050}
true
0
0
value
1.00000000
AndItsAll.wav
Browse Audio File
/
false
false
_Browse
179
303
330
28
{68b5f90b-b78e-4581-b434-232db5f4c40f}
true
0
0
left
Arial
10
3
0
0
0
229
229
229
nobackground
208
206
100
30
{dc1bccf4-d23b-4470-9c3f-5e576f314662}
true
0
0
right
Arial
10
3
0
0
0
255
255
255
noborder
1
1
MinPoints
308
206
60
30
{ba683795-bc00-46ba-8540-c6c32edb8bd5}
true
0
0
center
Arial
14
0
0
0
255
255
255
1.00000000
1
20
false
1
MaxTracks
139
206
60
30
{90b425e6-cc7a-4b70-bd54-52c1a629ce97}
true
0
0
center
Arial
14
0
0
0
255
255
255
1.00000000
1
100
false
30
39
206
100
30
{0c5a5f45-e32e-4e9c-b277-3c4e6c3cc04d}
true
0
0
right
Arial
10
3
0
0
0
255
255
255
noborder
1
1
179
331
330
30
{a63909ac-6fa4-41c8-a84b-ba08e76132ab}
true
0
0
left
Liberation Sans
12
3
0
0
0
255
255
255
noborder
1
1
Scaling
448
123
60
30
{96be62fb-9f2a-4761-9be8-9aef6d88dda7}
true
0
0
right
Arial
9
3
0
0
0
255
255
255
noborder
1
1
Scaling
8
100
500
27
{592ae49e-376b-419b-aa00-13c6872a64e7}
true
0
0
0.00000000
1.00000000
0.50000000
lin
continuous
-1.00000000
false
8
123
180
30
{cfbe3e3a-7a32-4ca8-aa84-7da2153cd059}
true
0
0
left
Arial
10
3
0
0
0
255
255
255
noborder
1
1
Transp_Value
448
172
60
30
{59581403-249b-41d7-a156-8fecc4c57eb9}
true
0
0
right
Arial
9
3
0
0
0
255
255
255
noborder
1
1
Transp
8
149
500
27
{d0db0fef-0b84-4670-9350-204802c497dc}
true
0
0
0.00000000
1.00000000
0.60000002
lin
continuous
-1.00000000
false
8
172
180
30
{8cecc9b3-e38a-4be6-8564-0b15fc468eb5}
true
0
0
left
Arial
10
3
0
0
0
255
255
255
noborder
1
1
MaxGap_Value
448
265
60
30
{6085eec4-7509-4f6a-bd6c-0eef9d429052}
true
0
0
right
Arial
9
3
0
0
0
255
255
255
noborder
1
1
MaxGap
8
242
500
27
{9a522256-841f-4a44-8055-0a2e94ca165e}
true
0
0
0.00000000
1.00000000
0.47799999
lin
continuous
-1.00000000
false
8
265
180
30
{8540055f-d4a9-41d9-92fb-c2e54ed6551e}
true
0
0
left
Arial
10
3
0
0
0
255
255
255
noborder
1
1