| 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 zawm.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 |
; Initialize the ZAK space. |
| 18 |
; Create 1 a-rate variable and 1 k-rate variable. |
| 19 |
zakinit 1, 1 |
| 20 |
|
| 21 |
; Instrument #1 -- a basic instrument. |
| 22 |
instr 1 |
| 23 |
; Generate a simple sine waveform. |
| 24 |
asin oscil 15000, 440, 1 |
| 25 |
|
| 26 |
; Mix the sine waveform with za variable #1. |
| 27 |
zawm asin, 1 |
| 28 |
endin |
| 29 |
|
| 30 |
; Instrument #2 -- another basic instrument. |
| 31 |
instr 2 |
| 32 |
; Generate another waveform with a different frequency. |
| 33 |
asin oscil 15000, 880, 1 |
| 34 |
|
| 35 |
; Mix this sine waveform with za variable #1. |
| 36 |
zawm asin, 1 |
| 37 |
endin |
| 38 |
|
| 39 |
; Instrument #3 -- generates audio output. |
| 40 |
instr 3 |
| 41 |
; Read za variable #1, containing both waveforms. |
| 42 |
a1 zar 1 |
| 43 |
|
| 44 |
; Generate the audio output. |
| 45 |
out a1 |
| 46 |
|
| 47 |
; Clear the za variables, get them ready for |
| 48 |
; another pass. |
| 49 |
zacl 0, 1 |
| 50 |
endin |
| 51 |
|
| 52 |
|
| 53 |
</CsInstruments> |
| 54 |
<CsScore> |
| 55 |
|
| 56 |
; Table #1, a sine wave. |
| 57 |
f 1 0 16384 10 1 |
| 58 |
|
| 59 |
; Play Instrument #1 for one second. |
| 60 |
i 1 0 1 |
| 61 |
; Play Instrument #2 for one second. |
| 62 |
i 2 0 1 |
| 63 |
; Play Instrument #3 for one second. |
| 64 |
i 3 0 1 |
| 65 |
e |
| 66 |
|
| 67 |
|
| 68 |
</CsScore> |
| 69 |
</CsoundSynthesizer> |