Debian Codegraph @

examples/inleta.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 inleta.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 sr = 44100
12 ksmps = 32
13 nchnls = 2
14
15 ; Connect up instruments and effects to create the signal flow graph.
16
17 connect "SimpleSine", "leftout", "Reverberator", "leftin"
18 connect "SimpleSine", "rightout","Reverberator", "rightin"
19
20 connect "Moogy", "leftout", "Reverberator", "leftin"
21 connect "Moogy", "rightout","Reverberator", "rightin"
22
23 connect "Reverberator", "leftout", "Compressor", "leftin"
24 connect "Reverberator", "rightout","Compressor", "rightin"
25
26 connect "Compressor", "leftout", "Soundfile", "leftin"
27 connect "Compressor", "rightout","Soundfile", "rightin"
28
29 ; Turn on the "effect" units in the signal flow graph.
30
31 alwayson "Reverberator", 0.91, 12000
32 alwayson "Compressor"
33 alwayson "Soundfile"
34
35 ; Define instruments and effects in order of signal flow.
36
37 instr SimpleSine
38 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
39 ; Default values: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10
40 pset 0, 0, 10, 0, 0, 0, 0.5
41 iattack = 0.015
42 idecay = 0.07
43 isustain = p3
44 irelease = 0.3
45 p3 = iattack + idecay + isustain + irelease
46 adamping linsegr 0.0, iattack, 1.0, idecay + isustain, 1.0, irelease, 0.0
47 iHz = cpsmidinn(p4)
48 ; Rescale MIDI velocity range to a musically usable range of dB.
49 iamplitude = ampdb(p5 / 127 * 15.0 + 60.0)
50 ; Use ftgenonce instead of ftgen, ftgentmp, or f statement.
51 icosine ftgenonce 0, 0, 65537, 11, 1
52 aoscili oscili iamplitude, iHz, icosine
53 aadsr madsr iattack, idecay, 0.6, irelease
54 asignal = aoscili * aadsr
55 aleft, aright pan2 asignal, p7
56 ; Stereo audio output to be routed in the orchestra header.
57 outleta "leftout", aleft
58 outleta "rightout", aright
59 endin
60
61 instr Moogy
62 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
63 ; Default values: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10
64 pset 0, 0, 10, 0, 0, 0, 0.5
65 iattack = 0.003
66 isustain = p3
67 irelease = 0.05
68 p3 = iattack + isustain + irelease
69 adamping linsegr 0.0, iattack, 1.0, isustain, 1.0, irelease, 0.0
70 iHz = cpsmidinn(p4)
71 ; Rescale MIDI velocity range to a musically usable range of dB.
72 iamplitude = ampdb(p5 / 127 * 20.0 + 60.0)
73 print iHz, iamplitude
74 ; Use ftgenonce instead of ftgen, ftgentmp, or f statement.
75 isine ftgenonce 0, 0, 65537, 10, 1
76 asignal vco iamplitude, iHz, 1, 0.5, isine
77 kfco line 2000, p3, 200
78 krez = 0.8
79 asignal moogvcf asignal, kfco, krez, 100000
80 asignal = asignal * adamping
81 aleft, aright pan2 asignal, p7
82 ; Stereo audio output to be routed in the orchestra header.
83 outleta "leftout", aleft
84 outleta "rightout", aright
85 endin
86
87 instr Reverberator
88 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
89 ; Stereo input.
90 aleftin inleta "leftin"
91 arightin inleta "rightin"
92 idelay = p4
93 icutoff = p5
94 aleft, aright reverbsc aleftin, arightin, idelay, icutoff
95 ; Stereo output.
96 outleta "leftout", aleft
97 outleta "rightout", aright
98 endin
99
100 instr Compressor
101 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
102 ; Stereo input.
103 aleftin inleta "leftin"
104 arightin inleta "rightin"
105 kthreshold = 25000
106 icomp1 = 0.5
107 icomp2 = 0.763
108 irtime = 0.1
109 iftime = 0.1
110 aleftout dam aleftin, kthreshold, icomp1, icomp2, irtime, iftime
111 arightout dam arightin, kthreshold, icomp1, icomp2, irtime, iftime
112 ; Stereo output.
113 outleta "leftout", aleftout
114 outleta "rightout", arightout
115 endin
116
117 instr Soundfile
118 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
119 ; Stereo input.
120 aleftin inleta "leftin"
121 arightin inleta "rightin"
122 outs aleftin, arightin
123 endin
124
125 </CsInstruments>
126 <CsScore>
127
128 ; It is not necessary to activate "effects" or create f-tables in the score!
129 ; Overlapping notes create new instances of instruments with proper connections.
130
131 i "SimpleSine" 1 5 60 85
132 i "SimpleSine" 2 5 64 80
133 i "Moogy" 3 5 67 75
134 i "Moogy" 4 5 71 70
135 ;1 extra second after the performance
136 e 1
137
138 </CsScore>
139 </CsoundSynthesizer>