;Written by Iain McCurdy, 2009
; Modified for QuteCsound by René, January 2011
; Tested on Ubuntu 10.04 with csound-float 5.13.0 and QuteCsound svn rev 817
;Notes on modifications from original csd:
;my flags on Ubuntu: -dm0 -iadc -odac -+rtaudio=jack -b16 -B4096 --expression-opt -+rtmidi=alsa -Ma
sr = 44100 ;SAMPLE RATE
ksmps = 16 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE
nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO)
instr 10 ;GUI
ktrig metro 10
if (ktrig == 1)then
gktrig invalue "Play_Stop"
ktrigOn trigger gktrig, 0.5, 0
schedkwhen ktrigOn, 0, 0, 2, 0, 0.01
gkmute invalue "Mute_Live"
gkdur invalue "Duration"
gkpitch invalue "Pitch"
gkfad invalue "Crossfade"
gkInGain invalue "Input_Gain"
endif
endin
instr 1 ;MIDI ACTIVATED INSTRUMENT - READS MIDI NOTE VALUES
icps cpsmidi ;READ PITCH VALUES (IN HERTZ) FROM A CONNECTED MIDI KEYBOARD
ifreqratio = icps/261.626 ;DERIVE A FREQUENCY RATI0 (BASE FREQUENCY IS MIDDLE C)
outvalue "Pitch", ifreqratio ;SEND FREQUENCY RATIO VALUE TO 'Pitch' FADER.
gkpitch init ifreqratio ;SET gkpitch TO ifreqratio.
endin
instr 2 ;RESTARTS INSTR 3 WHEN RECORD-PLAY/STOP IS PRESSED
turnon 3
endin
instr 3 ;SOUND PRODUCING INSTRUMENT
krecflag init 0
ain inch 1 ;READ AUDIO FROM LIVE INPUT CHANNEL 1
asig, krec sndloop ain*gkInGain, gkpitch, gktrig, i(gkdur), i(gkfad)
kupdate changed krec ;IF krec CHANGES, (I.E. STATE CHANGES FROM RECORDING TO PLAYBACK), kupdate WILL BE MOMENTARILY 1
if kupdate = 1 then
outvalue "Recording", krec ;UPDATE 'RECORDING' INDICATOR
endif
krecflag max krec, krecflag
if gkmute = 1 then
if (krecflag == 1 && krec == 0) then
outs asig, asig ;SEND AUDIO TO OUTPUT
endif
else
outs asig, asig ;SEND AUDIO TO OUTPUT
endif
endin
i 10 0 3600 ;GUI
i 2 0 3600 ;INSTRUMENT PLAYS FOR 1 HOUR (AND SUSTAINS REALTIME PERFORMANCE)
657
667
1000
327
true
202
202
202
2
2
512
320
{395a9956-93f5-441f-b0ef-3828f1b2da1c}
true
0
0
center
Liberation Sans
18
3
0
0
0
181
199
255
border
5
2
Play_Stop
8
42
130
30
{c54faf18-3b5b-4a78-b803-69b1c339890e}
true
0
0
value
1.00000000
Rec-Play / Stop
/
true
false
Mute_Live
152
42
130
30
{63b09b32-866d-4b31-ba3c-fb6f456359dc}
true
0
0
value
1.00000000
Mute Live Input
/
true
false
516
2
480
320
{10e7ae72-c151-4c9d-9f49-e6b1585d8386}
true
0
0
center
Liberation Sans
18
3
0
0
0
181
199
255
border
5
2
517
17
477
302
{97dfe67c-26c1-4af5-b858-e301d6886c2e}
true
0
0
left
Liberation Sans
14
3
0
0
0
255
255
255
noborder
1
1
8
106
210
30
{2c897206-0dbc-47b5-ba68-915d83839ab6}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Duration
8
87
500
27
{304e78d8-b320-453a-b28f-86b0ca872b86}
true
0
0
0.00000000
10.00000000
4.00000000
lin
continuous
-1.00000000
false
Duration
448
106
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
154
120
30
{7186de75-bab8-4534-b81d-333dea34bde8}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Pitch
8
135
500
27
{21c23ac4-26ce-4b74-88d5-8c36439204d3}
true
0
0
-4.00000000
4.00000000
1.00800000
lin
continuous
-1.00000000
false
Pitch
448
154
60
30
{0b0ea6ec-a2b7-48a8-beeb-ddc4a43ab18b}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
8
203
310
30
{2e87e987-1738-4cb5-8758-71fae356afeb}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Crossfade
8
184
500
27
{e984c4f5-5ed8-435f-912c-bd859309ae47}
true
0
0
0.00000000
5.00000000
1.38000000
lin
continuous
-1.00000000
false
Crossfade
448
203
60
30
{75870351-61d9-4470-8865-f2b00c777ff0}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
8
252
100
30
{e7ab5e78-0242-43d4-9a05-6d6260c10833}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Input_Gain
8
233
500
27
{3159a008-2bd8-4149-b211-649c65101258}
true
0
0
0.00000000
1.00000000
0.80000000
lin
continuous
-1.00000000
false
Input_Gain
448
252
60
30
{9fc48d5e-b81f-4891-8091-49fdb18566a4}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
Recording
408
44
100
26
{6418d1d7-3588-4191-bfff-af56034342ed}
true
0
0
0.00000000
1.00000000
0.00000000
1.00000000
0.00000000
0.00000000
fill
1
0.00000000
jump
255
0
0
false
0
0
0
408
46
100
30
{56201220-76ed-4652-a7e7-e674208835a2}
true
0
0
center
Liberation Sans
12
3
0
0
0
255
255
255
noborder
1
1