2
2
<emphasis role="csdtag"><CsoundSynthesizer></emphasis>
3
3
<emphasis role="csdtag"><CsOptions></emphasis>
4
4
<emphasis role="comment">; Select audio/midi flags here according to platform</emphasis>
5
<emphasis role="comment">; Audio out Audio in No messages</emphasis>
6
-odac -iadc -d <emphasis role="comment">;;;RT audio I/O</emphasis>
5
-odac <emphasis role="comment">;;;RT audio out</emphasis>
6
<emphasis role="comment">;-iadc ;;;uncomment -iadc if RT audio input is needed too</emphasis>
7
7
<emphasis role="comment">; For Non-realtime ouput leave only the line below:</emphasis>
8
8
<emphasis role="comment">; -o adsr.wav -W ;;; for file output any platform</emphasis>
9
9
<emphasis role="csdtag"></CsOptions></emphasis>
10
10
<emphasis role="csdtag"><CsInstruments></emphasis>
12
<emphasis role="comment">; Initialize the global variables.</emphasis>
13
12
<emphasis role="ohdr">sr</emphasis> <emphasis role="op">=</emphasis> 44100
14
<emphasis role="ohdr">kr</emphasis> <emphasis role="op">=</emphasis> 4410
15
<emphasis role="ohdr">ksmps</emphasis> <emphasis role="op">=</emphasis> 10
16
<emphasis role="ohdr">nchnls</emphasis> <emphasis role="op">=</emphasis> 1
13
<emphasis role="ohdr">ksmps</emphasis> <emphasis role="op">=</emphasis> 32
14
<emphasis role="ohdr">nchnls</emphasis> <emphasis role="op">=</emphasis> 2
15
<emphasis role="ohdr">0dbfs</emphasis> <emphasis role="op">=</emphasis> 1
18
<emphasis role="comment">; Instrument #1 - a simple instrument.</emphasis>
19
17
<emphasis role="oblock">instr</emphasis> 1
20
<emphasis role="comment">; Set the amplitude.</emphasis>
21
kamp <emphasis role="opc">init</emphasis> 20000
22
<emphasis role="comment">; Get the frequency from the fourth p-field.</emphasis>
23
kcps <emphasis role="op">=</emphasis> <emphasis role="opc">cpspch</emphasis>(p4)
25
a1 <emphasis role="opc">vco</emphasis> kamp, kcps, 1
26
<emphasis role="opc">out</emphasis> a1
27
<emphasis role="oblock">endin</emphasis>
29
<emphasis role="comment">; Instrument #2 - instrument with an ADSR envelope.</emphasis>
30
<emphasis role="oblock">instr</emphasis> 2
31
iatt <emphasis role="op">=</emphasis> 0.05
32
idec <emphasis role="op">=</emphasis> 0.5
33
islev <emphasis role="op">=</emphasis> 0.08
34
irel <emphasis role="op">=</emphasis> 0.008
36
<emphasis role="comment">; Create an amplitude envelope.</emphasis>
37
kenv <emphasis role="opc">adsr</emphasis> iatt, idec, islev, irel
38
kamp <emphasis role="op">=</emphasis> kenv <emphasis role="op">*</emphasis> 20000
40
<emphasis role="comment">; Get the frequency from the fourth p-field.</emphasis>
41
kcps <emphasis role="op">=</emphasis> <emphasis role="opc">cpspch</emphasis>(p4)
43
a1 <emphasis role="opc">vco</emphasis> kamp, kcps, 1
44
<emphasis role="opc">out</emphasis> a1
45
<emphasis role="oblock">endin</emphasis>
19
iatt <emphasis role="op">=</emphasis> p5
20
idec <emphasis role="op">=</emphasis> p6
21
islev <emphasis role="op">=</emphasis> p7
22
irel <emphasis role="op">=</emphasis> p8
24
kenv <emphasis role="opc">adsr</emphasis> iatt, idec, islev, irel
25
kcps <emphasis role="op">=</emphasis> <emphasis role="opc">cpspch</emphasis>(p4) <emphasis role="comment">;frequency</emphasis>
27
asig <emphasis role="opc">vco2</emphasis> kenv <emphasis role="op">*</emphasis> 0.8, kcps
28
<emphasis role="opc">outs</emphasis> asig, asig
30
<emphasis role="oblock">endin</emphasis>
48
32
<emphasis role="csdtag"></CsInstruments></emphasis>
49
33
<emphasis role="csdtag"><CsScore></emphasis>
51
<emphasis role="comment">; Table #1, a sine wave.</emphasis>
52
<emphasis role="stamnt">f</emphasis> 1 0 16384 10 1
54
<emphasis role="comment">; Set the tempo to 120 beats per minute.</emphasis>
55
<emphasis role="stamnt">t</emphasis> 0 120
57
<emphasis role="comment">; Play a melody with Instrument #1.</emphasis>
58
<emphasis role="comment">; p4 = frequency in pitch-class notation.</emphasis>
59
<emphasis role="stamnt">i</emphasis> 1 0 1 8.04
60
<emphasis role="stamnt">i</emphasis> 1 1 1 8.04
61
<emphasis role="stamnt">i</emphasis> 1 2 1 8.05
62
<emphasis role="stamnt">i</emphasis> 1 3 1 8.07
63
<emphasis role="stamnt">i</emphasis> 1 4 1 8.07
64
<emphasis role="stamnt">i</emphasis> 1 5 1 8.05
65
<emphasis role="stamnt">i</emphasis> 1 6 1 8.04
66
<emphasis role="stamnt">i</emphasis> 1 7 1 8.02
67
<emphasis role="stamnt">i</emphasis> 1 8 1 8.00
68
<emphasis role="stamnt">i</emphasis> 1 9 1 8.00
69
<emphasis role="stamnt">i</emphasis> 1 10 1 8.02
70
<emphasis role="stamnt">i</emphasis> 1 11 1 8.04
71
<emphasis role="stamnt">i</emphasis> 1 12 2 8.04
72
<emphasis role="stamnt">i</emphasis> 1 14 2 8.02
74
<emphasis role="comment">; Repeat the melody with Instrument #2.</emphasis>
75
<emphasis role="comment">; p4 = frequency in pitch-class notation.</emphasis>
76
<emphasis role="stamnt">i</emphasis> 2 16 1 8.04
77
<emphasis role="stamnt">i</emphasis> 2 17 1 8.04
78
<emphasis role="stamnt">i</emphasis> 2 18 1 8.05
79
<emphasis role="stamnt">i</emphasis> 2 19 1 8.07
80
<emphasis role="stamnt">i</emphasis> 2 20 1 8.07
81
<emphasis role="stamnt">i</emphasis> 2 21 1 8.05
82
<emphasis role="stamnt">i</emphasis> 2 22 1 8.04
83
<emphasis role="stamnt">i</emphasis> 2 23 1 8.02
84
<emphasis role="stamnt">i</emphasis> 2 24 1 8.00
85
<emphasis role="stamnt">i</emphasis> 2 25 1 8.00
86
<emphasis role="stamnt">i</emphasis> 2 26 1 8.02
87
<emphasis role="stamnt">i</emphasis> 2 27 1 8.04
88
<emphasis role="stamnt">i</emphasis> 2 28 2 8.04
89
<emphasis role="stamnt">i</emphasis> 2 30 2 8.02
35
<emphasis role="stamnt">i</emphasis> 1 0 1 7.00 .0001 1 .01 .001 <emphasis role="comment">; short attack</emphasis>
36
<emphasis role="stamnt">i</emphasis> 1 2 1 7.02 1 .5 .01 .001 <emphasis role="comment">; long attack</emphasis>
37
<emphasis role="stamnt">i</emphasis> 1 4 2 6.09 .0001 1 .1 .7 <emphasis role="comment">; long release</emphasis>
90
39
<emphasis role="stamnt">e</emphasis>
93
41
<emphasis role="csdtag"></CsScore></emphasis>
94
42
<emphasis role="csdtag"></CsoundSynthesizer></emphasis>
b'\\ No newline at end of file'