Debian Codegraph @

examples/chnmix.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 chnmix.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10 ;Example by Joachim Heintz
11 sr = 44100
12 ksmps = 32
13 nchnls = 2
14 0dbfs = 1
15
16 instr 1; send i-values
17 chnset 1, "sio"
18 chnset -1, "non"
19 endin
20
21 instr 2; send k-values
22 kfreq randomi 100, 300, 1
23 chnset kfreq, "cntrfreq"
24 kbw = kfreq/10
25 chnset kbw, "bandw"
26 endin
27
28 instr 3; send a-values
29 anois rand .1
30 chnset anois, "noise"
31 loop:
32 idur random .3, 1.5
33 timout 0, idur, do
34 reinit loop
35 do:
36 ifreq random 400, 1200
37 iamp random .1, .3
38 asig oscils iamp, ifreq, 0
39 aenv transeg 1, idur, -10, 0
40 asine = asig * aenv
41 chnset asine, "sine"
42 endin
43
44 instr 11; receive some chn values and send again
45 ival1 chnget "sio"
46 ival2 chnget "non"
47 print ival1, ival2
48 kcntfreq chnget "cntrfreq"
49 kbandw chnget "bandw"
50 anoise chnget "noise"
51 afilt reson anoise, kcntfreq, kbandw
52 afilt balance afilt, anoise
53 chnset afilt, "filtered"
54 endin
55
56 instr 12; mix the two audio signals
57 amix1 chnget "sine"
58 amix2 chnget "filtered"
59 chnmix amix1, "mix"
60 chnmix amix2, "mix"
61 endin
62
63 instr 20; receive and reverb
64 amix chnget "mix"
65 aL, aR freeverb amix, amix, .8, .5
66 outs aL, aR
67 endin
68
69 instr 100; clear
70 chnclear "mix"
71 endin
72
73 </CsInstruments>
74 <CsScore>
75 i 1 0 20
76 i 2 0 20
77 i 3 0 20
78 i 11 0 20
79 i 12 0 20
80 i 20 0 20
81 i 100 0 20
82 </CsScore>
83 </CsoundSynthesizer>