| 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 zamod.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 2 a-rate variables and 2 k-rate variables. |
| 19 |
zakinit 2, 2 |
| 20 |
|
| 21 |
; Instrument #1 -- a simple waveform. |
| 22 |
instr 1 |
| 23 |
; Vary an a-rate signal linearly from 20,000 to 0. |
| 24 |
asig line 20000, p3, 0 |
| 25 |
|
| 26 |
; Send the signal to za variable #1. |
| 27 |
zaw asig, 1 |
| 28 |
endin |
| 29 |
|
| 30 |
; Instrument #2 -- generates audio output. |
| 31 |
instr 2 |
| 32 |
; Generate a simple sine wave. |
| 33 |
asin oscil 1, 440, 1 |
| 34 |
|
| 35 |
; Modify the sine wave, multiply its amplitude by |
| 36 |
; za variable #1. |
| 37 |
a1 zamod asin, -1 |
| 38 |
|
| 39 |
; Generate the audio output. |
| 40 |
out a1 |
| 41 |
|
| 42 |
; Clear the za variables, prepare them for |
| 43 |
; another pass. |
| 44 |
zacl 0, 2 |
| 45 |
endin |
| 46 |
|
| 47 |
|
| 48 |
</CsInstruments> |
| 49 |
<CsScore> |
| 50 |
|
| 51 |
; Table #1, a sine wave. |
| 52 |
f 1 0 16384 10 1 |
| 53 |
|
| 54 |
; Play Instrument #1 for 2 seconds. |
| 55 |
i 1 0 2 |
| 56 |
; Play Instrument #2 for 2 seconds. |
| 57 |
i 2 0 2 |
| 58 |
e |
| 59 |
|
| 60 |
|
| 61 |
</CsScore> |
| 62 |
</CsoundSynthesizer> |