| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out Audio in No messages |
| 5 |
-odac -iadc -d ;;;RT audio I/O |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o madsr.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
/* Written by Iain McCurdy */ |
| 12 |
; Initialize the global variables. |
| 13 |
sr = 44100 |
| 14 |
kr = 441 |
| 15 |
ksmps = 100 |
| 16 |
nchnls = 1 |
| 17 |
|
| 18 |
; Instrument #1. |
| 19 |
instr 1 |
| 20 |
; Attack time. |
| 21 |
iattack = 0.5 |
| 22 |
; Decay time. |
| 23 |
idecay = 0 |
| 24 |
; Sustain level. |
| 25 |
isustain = 1 |
| 26 |
; Release time. |
| 27 |
irelease = 0.5 |
| 28 |
aenv madsr iattack, idecay, isustain, irelease |
| 29 |
|
| 30 |
a1 oscili 10000, 440, 1 |
| 31 |
out a1*aenv |
| 32 |
endin |
| 33 |
|
| 34 |
|
| 35 |
</CsInstruments> |
| 36 |
<CsScore> |
| 37 |
|
| 38 |
/* Written by Iain McCurdy */ |
| 39 |
; Table #1, a sine wave. |
| 40 |
f 1 0 1024 10 1 |
| 41 |
|
| 42 |
; Leave the score running for 6 seconds. |
| 43 |
f 0 6 |
| 44 |
|
| 45 |
; Play Instrument #1 for two seconds. |
| 46 |
i 1 0 2 |
| 47 |
e |
| 48 |
|
| 49 |
|
| 50 |
</CsScore> |
| 51 |
</CsoundSynthesizer> |