| 1 |
<Cabbage> |
| 2 |
form caption("Simple Synth") size(450, 220), \ |
| 3 |
colour(58, 110, 182), \ |
| 4 |
pluginID("def1") |
| 5 |
keyboard bounds(14, 88, 413, 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(292, 14, 70, 70), \ |
| 23 |
channel("cutoff"), \ |
| 24 |
range(0, 22000, 2000, .5, .01), \ |
| 25 |
text("Cut-Off") |
| 26 |
rslider bounds(360, 14, 70, 70), \ |
| 27 |
channel("res"), range(0, 1, 0.7, 1, .01), \ |
| 28 |
text("Resonance") |
| 29 |
</Cabbage> |
| 30 |
<CsoundSynthesizer> |
| 31 |
<CsOptions> |
| 32 |
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5 |
| 33 |
</CsOptions> |
| 34 |
<CsInstruments> |
| 35 |
; Initialize the global variables. |
| 36 |
sr = 44100 |
| 37 |
ksmps = 32 |
| 38 |
nchnls = 2 |
| 39 |
0dbfs = 1 |
| 40 |
|
| 41 |
;instrument will be triggered by keyboard widget |
| 42 |
instr 1 |
| 43 |
iFreq = p4 |
| 44 |
iAmp = p5 |
| 45 |
|
| 46 |
iAtt chnget "att" |
| 47 |
iDec chnget "dec" |
| 48 |
iSus chnget "sus" |
| 49 |
iRel chnget "rel" |
| 50 |
kRes chnget "res" |
| 51 |
kCutOff chnget "cutoff" |
| 52 |
|
| 53 |
kEnv madsr iAtt, iDec, iSus, iRel |
| 54 |
aOut vco2 iAmp, iFreq |
| 55 |
aLP moogladder aOut, kCutOff, kRes |
| 56 |
outs aLP*kEnv, aLP*kEnv |
| 57 |
endin |
| 58 |
|
| 59 |
</CsInstruments> |
| 60 |
<CsScore> |
| 61 |
;causes Csound to run for about 7000 years... |
| 62 |
f0 z |
| 63 |
</CsScore> |
| 64 |
</CsoundSynthesizer> |