| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac ;;;realtime audio out |
| 5 |
;-iadc ;;;uncomment -iadc if realtime audio input is needed too |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o readk2.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
sr = 44100 |
| 12 |
ksmps = 32 |
| 13 |
nchnls = 2 |
| 14 |
0dbfs = 1 |
| 15 |
|
| 16 |
giSine ftgen 0, 0, 2^10, 10, 1 |
| 17 |
|
| 18 |
instr 1 ;writes two control signals to a file |
| 19 |
kfreq randh 100, 1, 2, 1, 500 ;generates one random number between 400 and 600 per second |
| 20 |
kdb randh 12, 1, 2, 1, -12 ;amplitudes in dB between -24 and 0 |
| 21 |
dumpk2 kfreq, kdb, "dumpk2.txt", 8, 1 ;writes the control signals |
| 22 |
prints "WRITING:\n" |
| 23 |
printks "kfreq = %f, kdb = %f\n", 1, kfreq, kdb ;prints them |
| 24 |
endin |
| 25 |
|
| 26 |
instr 2 ;reads the file written by instr 1 |
| 27 |
kf,kdb readk2 "dumpk2.txt", 8, 1 |
| 28 |
prints "READING:\n" |
| 29 |
printks "kfreq = %f, kdb = %f\n", 1, kf, kdb ;prints again |
| 30 |
kdb lineto kdb, .1 ;smoothing amp transition |
| 31 |
aout poscil ampdb(kdb), kf, giSine |
| 32 |
outs aout, aout |
| 33 |
endin |
| 34 |
|
| 35 |
</CsInstruments> |
| 36 |
<CsScore> |
| 37 |
i 1 0 5 |
| 38 |
i 2 5 5 |
| 39 |
e |
| 40 |
</CsScore> |
| 41 |
</CsoundSynthesizer> |
| 42 |
|