| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Audio out Audio in No messages |
| 4 |
-odac -iadc -d ;;;RT audio I/O |
| 5 |
; -o cggoto.wav -W ;;; for file output any platform |
| 6 |
</CsOptions> |
| 7 |
<CsInstruments> |
| 8 |
|
| 9 |
; Initialize the global variables. |
| 10 |
sr = 44100 |
| 11 |
ksmps = 10 |
| 12 |
nchnls = 1 |
| 13 |
|
| 14 |
; Instrument #1. |
| 15 |
instr 1 |
| 16 |
i1 = p4 |
| 17 |
|
| 18 |
; If i1 is equal to one, play a high note. |
| 19 |
; Otherwise play a low note. |
| 20 |
cggoto (i1 == 1), highnote |
| 21 |
|
| 22 |
lownote: |
| 23 |
a1 oscil 10000, 220, 1 |
| 24 |
goto playit |
| 25 |
|
| 26 |
highnote: |
| 27 |
a1 oscil 10000, 440, 1 |
| 28 |
goto playit |
| 29 |
|
| 30 |
playit: |
| 31 |
out a1 |
| 32 |
endin |
| 33 |
|
| 34 |
|
| 35 |
</CsInstruments> |
| 36 |
<CsScore> |
| 37 |
|
| 38 |
; Table #1: a simple sine wave. |
| 39 |
f 1 0 32768 10 1 |
| 40 |
|
| 41 |
; Play lownote for one second. |
| 42 |
i 1 0 1 1 |
| 43 |
; Play highnote for one second. |
| 44 |
i 1 1 1 2 |
| 45 |
e |
| 46 |
|
| 47 |
</CsScore> |
| 48 |
</CsoundSynthesizer> |