| 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 zakinit.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
sr = 44100 |
| 12 |
ksmps = 4410 |
| 13 |
nchnls = 1 |
| 14 |
|
| 15 |
; Initialize the ZAK space. |
| 16 |
; Create 3 a-rate variables and 5 k-rate variables. |
| 17 |
zakinit 2, 3 |
| 18 |
|
| 19 |
instr 1 ;a simple waveform. |
| 20 |
; Generate a simple sine waveform. |
| 21 |
asin oscil 20000, 440, 1 |
| 22 |
|
| 23 |
; Send the sine waveform to za variable #1. |
| 24 |
zaw asin, 1 |
| 25 |
endin |
| 26 |
|
| 27 |
instr 2 ;generates audio output. |
| 28 |
; Read za variable #1. |
| 29 |
a1 zar 1 |
| 30 |
|
| 31 |
; Generate audio output. |
| 32 |
out a1 |
| 33 |
|
| 34 |
; Clear the za variables, get them ready for |
| 35 |
; another pass. |
| 36 |
zacl 0, 2 |
| 37 |
endin |
| 38 |
|
| 39 |
instr 3 ;increments k-type channels |
| 40 |
k0 zkr 0 |
| 41 |
k1 zkr 1 |
| 42 |
k2 zkr 2 |
| 43 |
|
| 44 |
zkw k0+1, 0 |
| 45 |
zkw k1+5, 1 |
| 46 |
zkw k2+10, 2 |
| 47 |
endin |
| 48 |
|
| 49 |
instr 4 ;displays values from k-type channels |
| 50 |
k0 zkr 0 |
| 51 |
k1 zkr 1 |
| 52 |
k2 zkr 2 |
| 53 |
|
| 54 |
; The total count for k0 is 30, since there are 10 |
| 55 |
; control blocks per second and intruments 3 and 4 |
| 56 |
; are on for 3 seconds. |
| 57 |
printf "k0 = %i\n",k0, k0 |
| 58 |
printf "k1 = %i\n",k1, k1 |
| 59 |
printf "k2 = %i\n",k2, k2 |
| 60 |
endin |
| 61 |
|
| 62 |
</CsInstruments> |
| 63 |
<CsScore> |
| 64 |
|
| 65 |
; Table #1, a sine wave. |
| 66 |
f 1 0 16384 10 1 |
| 67 |
|
| 68 |
i 1 0 1 |
| 69 |
i 2 0 1 |
| 70 |
|
| 71 |
i 3 0 3 |
| 72 |
i 4 0 3 |
| 73 |
e |
| 74 |
|
| 75 |
</CsScore> |
| 76 |
</CsoundSynthesizer> |