| 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 ckgoto.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
; Initialize the global variables. |
| 12 |
sr = 44100 |
| 13 |
kr = 4410 |
| 14 |
ksmps = 10 |
| 15 |
nchnls = 1 |
| 16 |
|
| 17 |
; Instrument #1. |
| 18 |
instr 1 |
| 19 |
; Change kval linearly from 0 to 2 over |
| 20 |
; the period set by the third p-field. |
| 21 |
kval line 0, p3, 2 |
| 22 |
|
| 23 |
; If kval is greater than or equal to 1 then play the high note. |
| 24 |
; If not then play the low note. |
| 25 |
ckgoto (kval >= 1), highnote |
| 26 |
kgoto lownote |
| 27 |
|
| 28 |
highnote: |
| 29 |
kfreq = 880 |
| 30 |
goto playit |
| 31 |
|
| 32 |
lownote: |
| 33 |
kfreq = 440 |
| 34 |
goto playit |
| 35 |
|
| 36 |
playit: |
| 37 |
; Print the values of kval and kfreq. |
| 38 |
printks "kval = %f, kfreq = %f\\n", 1, kval, kfreq |
| 39 |
|
| 40 |
a1 oscil 10000, kfreq, 1 |
| 41 |
out a1 |
| 42 |
endin |
| 43 |
|
| 44 |
|
| 45 |
</CsInstruments> |
| 46 |
<CsScore> |
| 47 |
|
| 48 |
; Table: a simple sine wave. |
| 49 |
f 1 0 32768 10 1 |
| 50 |
|
| 51 |
; Play Instrument #1 for two seconds. |
| 52 |
i 1 0 2 |
| 53 |
e |
| 54 |
|
| 55 |
|
| 56 |
</CsScore> |
| 57 |
</CsoundSynthesizer> |