| 1 |
<Cabbage> |
| 2 |
form caption("Simple Synth") size(310, 310), \ |
| 3 |
colour(58, 110, 182), \ |
| 4 |
pluginID("def1") |
| 5 |
keyboard bounds(12, 164, 281, 95) |
| 6 |
rslider bounds(12, 14, 70, 70), \ |
| 7 |
channel("att"), \ |
| 8 |
range(0, 1, 0.01, 1, .01), \ |
| 9 |
text("Attack") |
| 10 |
rslider bounds(82, 14, 70, 70), \ |
| 11 |
channel("dec"), \ |
| 12 |
range(0, 1, 0.5, 1, .01), \ |
| 13 |
text("Decay") |
| 14 |
rslider bounds(152, 14, 70, 70), \ |
| 15 |
channel("sus"), \ |
| 16 |
range(0, 1, 0.5, 1, .01), \ |
| 17 |
text("Sustain") |
| 18 |
rslider bounds(222, 14, 70, 70), \ |
| 19 |
channel("rel"), \ |
| 20 |
range(0, 1, 0.7, 1, .01), \ |
| 21 |
text("Release") |
| 22 |
rslider bounds(12, 84, 70, 70), \ |
| 23 |
channel("cutoff"), \ |
| 24 |
range(0, 22000, 2000, .5, .01), \ |
| 25 |
text("Cut-Off") |
| 26 |
rslider bounds(82, 84, 70, 70), \ |
| 27 |
channel("res"), \ |
| 28 |
range(0, 1, 0.7, 1, .01), \ |
| 29 |
text("Resonance") |
| 30 |
rslider bounds(152, 84, 70, 70), \ |
| 31 |
channel("LFOFreq"), \ |
| 32 |
range(0, 10, 0, 1, .01), \ |
| 33 |
text("LFO Freq") |
| 34 |
rslider bounds(222, 84, 70, 70), \ |
| 35 |
channel("amp"), \ |
| 36 |
range(0, 1, 0.7, 1, .01), \ |
| 37 |
text("Amp") |
| 38 |
</Cabbage> |
| 39 |
<CsoundSynthesizer> |
| 40 |
<CsOptions> |
| 41 |
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5 |
| 42 |
</CsOptions> |
| 43 |
<CsInstruments> |
| 44 |
; Initialize the global variables. |
| 45 |
sr = 44100 |
| 46 |
ksmps = 32 |
| 47 |
nchnls = 2 |
| 48 |
0dbfs = 1 |
| 49 |
|
| 50 |
;instrument will be triggered by keyboard widget |
| 51 |
instr 1 |
| 52 |
iFreq = p4 |
| 53 |
iAmp = p5 |
| 54 |
|
| 55 |
iAtt chnget "att" |
| 56 |
iDec chnget "dec" |
| 57 |
iSus chnget "sus" |
| 58 |
iRel chnget "rel" |
| 59 |
kRes chnget "res" |
| 60 |
kCutOff chnget "cutoff" |
| 61 |
kLFOFreq chnget "LFOFreq" |
| 62 |
kAmp chnget "amp" |
| 63 |
|
| 64 |
kEnv madsr iAtt, iDec, iSus, iRel |
| 65 |
aOut vco2 iAmp, iFreq |
| 66 |
kLFO lfo 1, kLFOFreq |
| 67 |
aLP moogladder aOut, kLFO*kCutOff, kRes |
| 68 |
outs kAmp*(aLP*kEnv), kAmp*(aLP*kEnv) |
| 69 |
endin |
| 70 |
|
| 71 |
</CsInstruments> |
| 72 |
<CsScore> |
| 73 |
;causes Csound to run for about 7000 years... |
| 74 |
f0 z |
| 75 |
</CsScore> |
| 76 |
</CsoundSynthesizer> |