;Written by Iain McCurdy, 2009
;Modified for QuteCsound by René, March 2011
;Tested on Ubuntu 10.04 with csound-float 5.13.0 and QuteCsound svn rev 817
;This instrument use the files impuls20.aiff and mandpluk.aiff
;Notes on modifications from original csd:
; Add tables for exp slider
; INIT instrument added
;my flags on Ubuntu: -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=alsa -Ma -m0
sr = 44100 ;SAMPLE RATE
ksmps = 100 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL
nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO)
0dbfs = 1 ;MAXIMUM AMPLITUDE REGARDLESS OF BIT DEPTH
giwfn1 ftgen 1, 0, 256, 1, "impuls20.aiff", 0, 0, 0 ;WAVEFORM SUGGESTED BY THE CSOUND MANUAL
giwfn2 ftgen 2, 0, 256, -7, 1, 128, 1, 0, -1, 128, -1 ;SQUARE WAVE
giafn ftgen 0, 0, 8192, 1, "mandpluk.aiff", 0, 0, 0 ;ATTACK WAVEFORM
givfn ftgen 0, 0, 256, 10, 1 ;VIBRATO WAVEFORM
giExp1 ftgen 0, 0, 129, -25, 0, 20.0, 128, 20000.0 ;TABLE FOR EXP SLIDER
instr 10 ;GUI and SYNCHRONIZE MIDI MOD. WHEEL AND GUI 'Vibrato Amplitude' SLIDER
ktrig metro 10
if (ktrig == 1) then
gkamp invalue "Amp"
kfreq invalue "Freq"
gkfreq tablei kfreq, giExp1, 1
outvalue "Freq_Value", gkfreq
gkfiltq invalue "FiltReso"
kfiltrate invalue "FiltRate"
gkfiltrate = kfiltrate * 0.0001
gkvibf invalue "VibFreq"
gkvamp invalue "VibAmp"
gkwfn invalue "Waveform"
endif
kvamp ctrl7 1,1,0,0.1 ;READ MODULATION WHEEL VALUES
ktrig changed kvamp ;CHECK TO SEE IF MOD. WHEEL HAS MOVED. OUTPUT A VALUE OF 1 IF IT HAS, OTHERWISE ZERO
if ktrig == 1 then
outvalue "VibAmp", kvamp ;UPDATE GUI SLIDER FOR VIBRATO AMPLITUDE IF ktrig=1
endif
endin
instr 1 ;MIDI ACTIVATED INSTRUMENT
ioct octmidi ;READ NOTE VALUES FROM MIDI INPUT IN THE 'OCT' FORMAT
;PITCH BEND INFORMATION IS READ
iSemitoneBendRange = 2 ;PITCH BEND RANGE IN SEMITONES (WILL BE DEFINED FURTHER LATER)
imin = 0 ;EQUILIBRIUM POSITION
imax = iSemitoneBendRange * .0833333 ;MAX PITCH DISPLACEMENT (IN oct FORMAT)
kbend pchbend imin, imax ;PITCH BEND VARIABLE (IN oct FORMAT)
kfreq = cpsoct(ioct+ kbend)
iwfn = i(gkwfn)+1
aenv linsegr 1,3600,1,0.01,0 ;ANTI-CLICK ENVELOPE
ares moog gkamp, kfreq, gkfiltq, gkfiltrate, gkvibf, gkvamp, giafn, iwfn, givfn
outs ares*aenv, ares*aenv ;SEND AUDIO TO OUTPUTS
endin
instr 2 ;GUI ACTIVATED INSTRUMENT
iwfn = i(gkwfn)+1
ares moog gkamp, gkfreq, gkfiltq, gkfiltrate, gkvibf, gkvamp, giafn, iwfn, givfn
outs ares, ares ;SEND AUDIO TO OUTPUTS
endin
instr 3 ;INIT
outvalue "Amp" , 0.03
outvalue "Freq" , 0.4
outvalue "FiltReso" , 0.85
outvalue "FiltRate" , 0.3
outvalue "VibFreq" , 5
outvalue "VibAmp" , 0
outvalue "Waveform" , 0
endin
;INSTR | START | DURATION
i 10 0 3600 ;GUI
i 3 0 0.1 ;INIT
72
179
400
200
true
241
226
185
2
2
510
370
{aa607456-d368-4d59-8497-d16d608404c3}
true
0
0
center
Liberation Sans
18
3
0
0
0
147
154
255
border
5
2
8
111
220
30
{640b50b7-7200-4f81-8394-89d9843ae939}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Amp
8
90
500
27
{5585fa6f-0f63-4ac3-bf1b-809c2b1d9134}
true
0
0
0.00000000
0.10000000
0.03000000
lin
continuous
-1.00000000
false
Amp
448
111
60
30
{b731b52e-e14a-476a-a583-f3b2bd885539}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
515
2
280
370
{74928ed2-b701-4668-9a11-74763d317e9b}
true
0
0
center
Liberation Sans
18
3
0
0
0
147
154
255
border
5
2
516
25
278
344
{d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a}
true
0
0
left
Liberation Sans
14
3
0
0
0
255
255
255
noborder
1
1
8
15
120
30
{04d44ebe-12eb-4bb0-a3f5-9e4fd3e7830e}
true
0
0
event
1.00000000
On / Off (MIDI)
/
i 2 0 -1
true
false
8
157
220
30
{1fee3c20-99d2-4c60-baa7-669d23492f06}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
Freq
8
136
500
27
{f5ebacc2-9a31-48e3-adb0-3cb090aec444}
true
0
0
0.00000000
1.00000000
0.40000001
lin
continuous
-1.00000000
false
Freq_Value
448
157
60
30
{221d17eb-f6ee-4286-a97f-e6bc5c0a1749}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
8
203
220
30
{bce7cccd-a303-4a57-af94-fd50cf914991}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
FiltReso
8
182
500
27
{aaf82558-9229-4d61-8190-0286f3764e87}
true
0
0
0.80000000
0.90000000
0.85000002
lin
continuous
-1.00000000
false
FiltReso
448
203
60
30
{1cd1723d-bcd9-44df-9f08-9d8191f03601}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
8
249
220
30
{0f0e06ef-104c-459c-8a8b-3bf531321341}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
FiltRate
8
228
500
27
{4a2f399c-8a7b-40cf-84ab-839e1d7012f5}
true
0
0
0.00000000
2.00000000
0.30000001
lin
continuous
-1.00000000
false
FiltRate
448
249
60
30
{62bd5b38-121f-4382-8c01-02c75edf2237}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
8
295
220
30
{3967c371-a6b0-46ca-a51c-5a44bcad618d}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
VibFreq
8
274
500
27
{fa94c4bb-3469-4fbf-9096-f6f7c115eb69}
true
0
0
0.00000000
16.00000000
5.00000000
lin
continuous
-1.00000000
false
VibFreq
448
295
60
30
{1f01b045-b441-4f44-8dfe-884fb64aba2a}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
8
341
220
30
{6b22e200-1bf3-42af-9de9-89c4a378e999}
true
0
0
left
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1
VibAmp
8
320
500
27
{6f93a49e-55f6-42d1-81f0-88dc52e071ed}
true
0
0
0.00000000
0.10000000
0.00000000
lin
continuous
-1.00000000
false
VibAmp
448
341
60
30
{88e65190-6184-44dd-bba2-2ca94caf8b47}
true
0
0
right
Liberation Sans
9
3
0
0
0
255
255
255
noborder
1
1
Waveform
262
49
120
30
{4d05e71c-4846-4f38-8c31-f1ad8c66261b}
true
0
0
Sawtooth
0
Square
1
0
false
162
53
100
30
{a7659823-fc33-43c8-a408-afd29bfd16c9}
true
0
0
right
Liberation Sans
10
3
0
0
0
255
255
255
noborder
1
1