| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 2 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
; -- create a FLTK panel -- |
| 12 |
FLpanel "Trigger By FLTK Button", 300, 100, 100, 100 |
| 13 |
; -- trigger instr 1 (equivalent to the score line "i 1 0 1") |
| 14 |
k1, ih1 FLbutton "Push me!", 0, 0, 1, 150, 40, 10, 25, 0, 1, 0, 1 |
| 15 |
; -- trigger instr 2 |
| 16 |
k2, ih2 FLbutton "Quit", 0, 0, 1, 80, 40, 200, 25, 0, 2, 0, 1 |
| 17 |
FLpanelEnd; end of the FLTK panel section |
| 18 |
FLrun ; run FLTK |
| 19 |
seed 0; random seed different each time |
| 20 |
|
| 21 |
instr 1 |
| 22 |
idur random .5, 3; recalculate instrument duration |
| 23 |
p3 = idur; reset instrument duration |
| 24 |
ioct random 8, 11; random values between 8th and 11th octave |
| 25 |
idb random -18, -6; random values between -6 and -18 dB |
| 26 |
aSig poscil ampdb(idb), cpsoct(ioct) |
| 27 |
aEnv transeg 1, p3, -10, 0 |
| 28 |
outs aSig*aEnv, aSig*aEnv |
| 29 |
endin |
| 30 |
|
| 31 |
instr 2 |
| 32 |
exitnow |
| 33 |
endin |
| 34 |
|
| 35 |
</CsInstruments> |
| 36 |
<CsScore> |
| 37 |
f 0 36000 |
| 38 |
e |
| 39 |
</CsScore> |
| 40 |
</CsoundSynthesizer> |
| 41 |
;example by joachim heintz |