| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out Audio in No messages |
| 5 |
-odac -iadc --displays ;;;RT audio I/O |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o xyin.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
; Initialize the global variables. |
| 12 |
sr = 44100 |
| 13 |
ksmps = 10 |
| 14 |
nchnls = 2 |
| 15 |
|
| 16 |
; Instrument #1. |
| 17 |
instr 1 |
| 18 |
; Print and capture values every 0.1 seconds. |
| 19 |
iprd = 0.1 |
| 20 |
; The x values are from 1 to 30. |
| 21 |
ixmin = 1 |
| 22 |
ixmax = 30 |
| 23 |
; The y values are from 1 to 30. |
| 24 |
iymin = 1 |
| 25 |
iymax = 30 |
| 26 |
; The initial values for X and Y are both 15. |
| 27 |
ixinit = 15 |
| 28 |
iyinit = 15 |
| 29 |
|
| 30 |
; Get the values kx and ky using the xyin opcode. |
| 31 |
kx, ky xyin iprd, ixmin, ixmax, iymin, iymax, ixinit, iyinit |
| 32 |
|
| 33 |
; Print out the values of kx and ky. |
| 34 |
printks "kx=%f, ky=%f\\n", iprd, kx, ky |
| 35 |
|
| 36 |
; Play an oscillator, use the x values for amplitude and |
| 37 |
; the y values for frequency. |
| 38 |
kamp = kx * 1000 |
| 39 |
kcps = ky * 220 |
| 40 |
a1 poscil kamp, kcps, 1 |
| 41 |
|
| 42 |
outs a1, a1 |
| 43 |
endin |
| 44 |
|
| 45 |
|
| 46 |
</CsInstruments> |
| 47 |
<CsScore> |
| 48 |
|
| 49 |
; Table #1, a sine wave. |
| 50 |
f 1 0 16384 10 1 |
| 51 |
|
| 52 |
; Play Instrument #1 for 30 seconds. |
| 53 |
i 1 0 30 |
| 54 |
e |
| 55 |
|
| 56 |
|
| 57 |
</CsScore> |
| 58 |
</CsoundSynthesizer> |