| 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 0dbfs.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 |
; Set the 0dbfs to 1. |
| 17 |
0dbfs = 1 |
| 18 |
|
| 19 |
instr 1 ; from linear amplitude (0-1 range) |
| 20 |
print p4 |
| 21 |
a1 oscil p4, 440, 1 |
| 22 |
outs a1, a1 |
| 23 |
endin |
| 24 |
|
| 25 |
instr 2 ; from linear amplitude (0-32767 range) |
| 26 |
iamp = p4 / 32767 |
| 27 |
print iamp |
| 28 |
a1 oscil iamp, 440, 1 |
| 29 |
outs a1, a1 |
| 30 |
endin |
| 31 |
|
| 32 |
instr 3 ; from dB FS |
| 33 |
iamp = ampdbfs(p4) |
| 34 |
print iamp |
| 35 |
a1 oscil iamp, 440, 1 |
| 36 |
outs a1, a1 |
| 37 |
endin |
| 38 |
|
| 39 |
|
| 40 |
</CsInstruments> |
| 41 |
<CsScore> |
| 42 |
|
| 43 |
; Table #1, a sine wave. |
| 44 |
f 1 0 16384 10 1 |
| 45 |
|
| 46 |
i 1 0 1 1 |
| 47 |
i 1 + 1 0.5 |
| 48 |
i 1 + 1 0.1 |
| 49 |
s |
| 50 |
i 2 0 1 32767 |
| 51 |
i 2 + 1 [32767/2] |
| 52 |
i 2 + 1 [3276.7] |
| 53 |
s |
| 54 |
i 3 0 1 0 |
| 55 |
i 3 + 1 -6 |
| 56 |
i 3 + 1 -20 |
| 57 |
e |
| 58 |
|
| 59 |
</CsScore> |
| 60 |
</CsoundSynthesizer> |
| 61 |
|