form caption("Untitled") size(400, 300), guiMode("queue"), pluginId("def1")
groupbox bounds(27, 98, 356, 64) channel("groupbox10006")
keyboard bounds(10, 186, 381, 95)
combobox bounds(108, 48, 80, 20) channel("combo10001")
rslider bounds(30, 100, 60, 60) channel("att"), range(0, 2, 0.01, 1, .01), text("Attack") trackerColour(255, 0, 255, 255)
rslider bounds(120, 100, 60, 60) channel("dec"), range(0, 2, 0.5, 1, 0.01), text("Decay")
rslider bounds(220, 102, 60, 60) channel("sus"), range(0, 2, 0.5, 1, .01), text("Sustain")
rslider bounds(320, 100, 60, 60) channel("rel"), range(0, 2, 0.7, 1, .01), text("Release")
-n -d -+rtmidi=NULL -M0 -m0d --midi-key=4 --midi-velocity-amp=5
; Initialize the global variables.
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
;instrument will be triggered by keyboard widget
instr 1
event "i", 10, 0, 1, p4, p5
kEnv madsr chnget:i("att"), chnget:i("dec"), chnget:i("sus"), chnget:i("rel")
endin
instr 10
iAmp = p5
if p4 == 72 then
p3 = filelen("/Users/wongmanhuen/Simple flower/C4.wav")
a1, a2 diskin2 "/Users/wongmanhuen/Simple flower/C4.wav", 1
elseif p4 == 73 then
p3 = filelen("D4.wav")
a1, a2 diskin2 "D4.wav", 1
elseif p4 == 74 then
//keep adding samples...
endif
outs a1*iAmp, a2*iAmp
endin
;causes Csound to run for about 7000 years...
f0 z