Debian Codegraph @

examples/k35.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 </CsOptions>
4 ; ==============================================
5 <CsInstruments>
6
7 sr = 48000
8 ksmps = 1
9 nchnls = 2
10 0dbfs = 1
11
12 ;; test instruments to demo filter cutoff sweep with high resonance
13
14 instr 1
15
16 asig = vco2(0.5, cps2pch(6.00, 12))
17 asig = K35_lpf(asig, expseg:a(10000, p3, 30), 9.9, 0, 1)
18 asig *= 0.25
19 asig = limit(asig, -1.0, 1.0)
20
21 outc(asig, asig)
22
23 endin
24
25
26 instr 2
27
28 asig = vco2(0.5, cps2pch(6.00, 12))
29 asig = K35_lpf(asig, expseg:k(10000, p3, 30), 9.9, 0, 1)
30 asig *= 0.25
31 asig = limit(asig, -1.0, 1.0)
32
33 outc(asig, asig)
34
35 endin
36
37 instr 3
38
39 asig = vco2(0.5, cps2pch(6.00, 12))
40 asig = K35_hpf(asig, expseg:a(10000, p3, 30), 9.9, 0, 1)
41 asig *= 0.25
42 asig = limit(asig, -1.0, 1.0)
43
44 outc(asig, asig)
45
46 endin
47
48
49 instr 4
50
51 asig = vco2(0.5, cps2pch(6.00, 12))
52 asig = K35_hpf(asig, expseg:k(10000, p3, 30), 9.9, 0, 1)
53 asig *= 0.25
54 asig = limit(asig, -1.0, 1.0)
55
56 outc(asig, asig)
57
58 endin
59
60 ;; beat instruments
61
62 instr ms20_drum
63
64 ipch = cps2pch(p4, 12)
65 iamp = ampdbfs(p5)
66 aenv = expseg:a(10000, 0.05, ipch, p3 - .05, ipch)
67
68 asig = rand:a(-1.0, 1.0)
69 asig = K35_hpf(asig, 60, 7, 1, 1)
70 asig = K35_lpf(asig, aenv, 9.8, 1, 1)
71
72 asig = tanh(asig * 16)
73
74 asig *= expon(iamp, p3, 0.0001)
75
76 outc(asig, asig)
77
78 endin
79
80 instr ms20_bass
81 ipch = cps2pch(p4, 12)
82 iamp = ampdbfs(p5)
83 aenv = expseg(1000, 0.1, ipch * 2, p3 - .05, ipch * 2)
84
85 asig = vco2(1.0, ipch)
86 asig = K35_hpf(asig, ipch, 5, 0, 1)
87 asig = K35_lpf(asig, aenv, 8, 0, 1)
88
89 asig *= expon:a(iamp, p3, 0.0001) * 0.8
90
91 outc(asig, asig)
92 endin
93
94 ;; perf code
95
96 gktempo init 122
97
98 opcode beat_dur,i,0
99 xout 60 / i(gktempo)
100 endop
101
102 instr bass_player
103 idur = beat_dur() / int(random(1,3))
104 ipch = 6.00 + int(random(1,3)) + int(random(1,3)) / 100
105
106 schedule("ms20_bass", 0, idur, ipch, -11)
107
108 if(p2 < 37.5) then
109 schedule("bass_player", idur, 0.1)
110 endif
111 turnoff
112 endin
113
114 instr beat_player
115 istep_total = p4
116 istep = istep_total % 16
117
118 if(istep % 4 == 0) then
119 ipch = ((istep_total % 128) < 112) ? 4.00 : 8.00
120 iamp = (istep == 0) ? -9 : -12
121 schedule("ms20_drum", 0, 0.5, ipch, iamp)
122 endif
123
124 schedule("ms20_drum", 0, 0.125, 14.00,
125 (istep % 4 == 0) ? -12 : -18)
126
127 if(p2 < 37.5) then
128 schedule("beat_player", beat_dur() / 4, 0.1, istep_total + 1)
129 endif
130 turnoff
131 endin
132
133 ;; start play of beats
134
135 instr start_beats
136 schedule("beat_player", 0, 0.1, 0)
137 schedule("bass_player", 0, 0.1)
138 endin
139
140
141 </CsInstruments>
142 ; ==============================================
143 <CsScore>
144 i1 0 5.0
145 i2 5 5.0
146 i3 10 5.0
147 i4 15 5.0
148
149 i "start_beats" 22 0.5 0
150
151 </CsScore>
152 </CsoundSynthesizer>
153