| 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 oscilikt.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 |
; Instrument #1. |
| 18 |
instr 1 |
| 19 |
; Generate a uni-polar (0-1) square wave. |
| 20 |
kamp1 init 1 |
| 21 |
kcps1 init 2 |
| 22 |
itype = 3 |
| 23 |
ksquare lfo kamp1, kcps1, itype |
| 24 |
|
| 25 |
; Use the square wave to switch between Tables #1 and #2. |
| 26 |
kamp2 init 20000 |
| 27 |
kcps2 init 220 |
| 28 |
kfn = ksquare + 1 |
| 29 |
|
| 30 |
a1 oscilikt kamp2, kcps2, kfn |
| 31 |
out a1 |
| 32 |
endin |
| 33 |
|
| 34 |
|
| 35 |
</CsInstruments> |
| 36 |
<CsScore> |
| 37 |
|
| 38 |
; Table #1, a sine waveform. |
| 39 |
f 1 0 4096 10 0 1 |
| 40 |
; Table #2: a sawtooth wave |
| 41 |
f 2 0 3 -2 1 0 -1 |
| 42 |
|
| 43 |
; Play Instrument #1 for two seconds. |
| 44 |
i 1 0 2 |
| 45 |
|
| 46 |
|
| 47 |
</CsScore> |
| 48 |
</CsoundSynthesizer> |