Debian Codegraph @

examples/dumpk3.csd

raw
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 dumpk3.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 three 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 kpan randh .5, 1, 2, 1, .5 ;panning between 0 and 1
22 dumpk3 kfreq, kdb, kpan, "dumpk3.txt", 8, 1 ;writes the control signals
23 prints "WRITING:\n"
24 printks "kfreq = %f, kdb = %f, kpan = %f\n", 1, kfreq, kdb, kpan ;prints them
25 endin
26
27 instr 2 ;reads the file written by instr 1
28 kf,kdb,kp readk3 "dumpk3.txt", 8, 1
29 prints "READING:\n"
30 printks "kfreq = %f, kdb = %f, kpan = %f\n", 1, kf, kdb, kp ;prints again
31 kdb lineto kdb, .1 ;smoothing amp transition
32 kp lineto kp, .1 ;smoothing pan transition
33 aout poscil ampdb(kdb), kf, giSine
34 aL, aR pan2 aout, kp
35 outs aL, aR
36 endin
37
38 </CsInstruments>
39 <CsScore>
40 i 1 0 5
41 i 2 5 5
42 e
43 </CsScore>
44 </CsoundSynthesizer>
45