Debian Codegraph @

examples/diode_ladder.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -o dac
4 </CsOptions>
5 <CsInstruments>
6 sr=44100
7 ksmps=16
8 nchnls=2
9 0dbfs=1
10
11
12 gi_sine ftgen 0, 0, 65537, 10, 1
13
14 gkcut init 6000
15
16
17 instr modulation
18 gkcut = lfo(4000, 0.1) + 6000
19 endin
20
21 instr bass
22
23 iamp = ampdbfs(-12)
24 ipch = cps2pch(p4, 12)
25
26 asig = vco2(0.5, ipch, 0)
27
28 acut = expon:a(i(gkcut), p3, 200)
29 aout = diode_ladder(asig, acut, 8, 1, 4)
30
31 aout *= expseg:a(1.0, p3 - 0.05, 1.0, 0.05, 0.001)
32
33 aout = limit(aout, -1.0, 1.0)
34
35 outc(aout, aout)
36
37 endin
38
39
40 gipat[] init 8
41 gipat[0] = 6.00
42 gipat[1] = 7.00
43 gipat[2] = 6.00
44 gipat[3] = 7.00
45 gipat[4] = 5.07
46 gipat[5] = 6.07
47 gipat[6] = 5.08
48 gipat[7] = 6.08
49
50
51 instr player
52 indx = p4
53
54 ;; play instrument
55 if(gipat[indx] > 0) then
56 schedule("bass", 0, 0.2, gipat[indx])
57 endif
58
59 ;; temporal recursion
60 schedule("player", 0.2, 0.1, (indx + 1) % lenarray(gipat))
61
62 endin
63
64 schedule("modulation", 0, -1)
65 schedule("player", 0, 0.1, 0)
66 event_i("e", 0, 0.1 * 128)
67
68 </CsInstruments>
69
70 <CsScore>
71 </CsScore>
72
73 </CsoundSynthesizer>