| 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 zkwm.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 k-rate signal. |
| 24 |
; The signal goes from 30 to 20,000 then back to 30. |
| 25 |
kramp linseg 30, p3/2, 20000, p3/2, 30 |
| 26 |
|
| 27 |
; Mix the signal into the zk variable #1. |
| 28 |
zkwm kramp, 1 |
| 29 |
endin |
| 30 |
|
| 31 |
; Instrument #2 -- another basic instrument. |
| 32 |
instr 2 |
| 33 |
; Generate another k-rate signal. |
| 34 |
; This is a low frequency oscillator. |
| 35 |
klfo lfo 3500, 2 |
| 36 |
|
| 37 |
; Mix this signal into the zk variable #1. |
| 38 |
zkwm klfo, 1 |
| 39 |
endin |
| 40 |
|
| 41 |
; Instrument #3 -- generates audio output. |
| 42 |
instr 3 |
| 43 |
; Read zk variable #1, containing a mix of both signals. |
| 44 |
kamp zkr 1 |
| 45 |
|
| 46 |
; Create a sine waveform. Its amplitude will vary |
| 47 |
; according to the values in zk variable #1. |
| 48 |
a1 oscil kamp, 880, 1 |
| 49 |
|
| 50 |
; Generate the audio output. |
| 51 |
out a1 |
| 52 |
|
| 53 |
; Clear the zk variable, get it ready for |
| 54 |
; another pass. |
| 55 |
zkcl 0, 1 |
| 56 |
endin |
| 57 |
|
| 58 |
|
| 59 |
</CsInstruments> |
| 60 |
<CsScore> |
| 61 |
|
| 62 |
; Table #1, a sine wave. |
| 63 |
f 1 0 16384 10 1 |
| 64 |
|
| 65 |
; Play Instrument #1 for 5 seconds. |
| 66 |
i 1 0 5 |
| 67 |
; Play Instrument #2 for 5 seconds. |
| 68 |
i 2 0 5 |
| 69 |
; Play Instrument #3 for 5 seconds. |
| 70 |
i 3 0 5 |
| 71 |
e |
| 72 |
|
| 73 |
|
| 74 |
</CsScore> |
| 75 |
</CsoundSynthesizer> |