| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac ;;;realtime audio out |
| 5 |
;-iadc ;;;uncomment -iadc if realtime audio input is needed too |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o endif.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
sr = 44100 |
| 12 |
ksmps = 32 |
| 13 |
nchnls = 2 |
| 14 |
0dbfs = 1 |
| 15 |
|
| 16 |
instr 1 |
| 17 |
; Get the note value from the fourth p-field. |
| 18 |
knote = p4 |
| 19 |
|
| 20 |
; Does the user want a low note? |
| 21 |
if (knote == 0) then |
| 22 |
kcps = 220 |
| 23 |
; Does the user want a middle note? |
| 24 |
elseif (knote == 1) then |
| 25 |
kcps = 440 |
| 26 |
; Does the user want a high note? |
| 27 |
elseif (knote == 2) then |
| 28 |
kcps = 880 |
| 29 |
endif |
| 30 |
|
| 31 |
; Create the note. |
| 32 |
kamp init .8 |
| 33 |
ifn = 1 |
| 34 |
a1 oscili kamp, kcps, ifn |
| 35 |
|
| 36 |
outs a1, a1 |
| 37 |
endin |
| 38 |
|
| 39 |
|
| 40 |
</CsInstruments> |
| 41 |
<CsScore> |
| 42 |
|
| 43 |
; Table #1, a sine wave. |
| 44 |
f 1 0 16384 10 1 |
| 45 |
|
| 46 |
; p4: 0=low note, 1=middle note, 2=high note. |
| 47 |
; Play Instrument #1 for one second, low note. |
| 48 |
i 1 0 1 0 |
| 49 |
; Play Instrument #1 for one second, middle note. |
| 50 |
i 1 1 1 1 |
| 51 |
; Play Instrument #1 for one second, high note. |
| 52 |
i 1 2 1 2 |
| 53 |
e |
| 54 |
|
| 55 |
|
| 56 |
</CsScore> |
| 57 |
</CsoundSynthesizer> |