Debian Codegraph @

examples/metro2.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac ; for RT audio
4 </CsOptions>
5 <CsInstruments>
6
7 sr = 44100
8 ksmps = 16
9 nchnls = 2
10 0dbfs = 1.0
11
12 ga1 init 0 ; delay aux
13
14 instr 1 ; main triggering instrument
15 kndx init 0
16 kndx2 init -1
17 ; the clicks are 1/16th notes @ 137 BPM
18 kT metro2 (4*137/60), p4, -1
19 if (kT == 0) goto Halt
20 k1 table kndx, 1, 0, 0, 1
21 kndx += 1
22 if (k1 == 0) goto Next
23 event "i", 2, 0, 0.35, k1
24 Next:
25 ; positive amplitude values of down-beat clicks
26 ; are used to trigger kick (instr 3)
27 if (kT < 1) goto Halt
28 kndx2 += 1
29 kndx2 wrap kndx2, 0, 2
30 if kndx2 != 0 goto Halt
31 event "i", 3, 0, 0.2
32 Halt:
33 endin
34
35 instr 2 ; simple subtractive bass
36 kAE linsegr 0, 0.005, 1, p3/2, .7, .04, 0, .04, 0
37 kFE linsegr 1, 0.005, 2, p3/2, .7, .04, .1, .04, .1
38 ifr = cpspch(p4)
39 a1 vco2 1, ifr
40 a2 vco2 1, ifr * 1.005
41 a3 vco2 1, ifr * 0.993
42 aM = (a1+a2+a3)/3
43 aM moogvcf aM*kAE, 1000 * kFE, 0.5
44 outs aM, aM
45 ga1 += aM * 0.25
46 endin
47
48 instr 3 ; simple techno kick
49 k1 linseg 200, p3, 10
50 k2 linseg 0,0.001,1,0.25,0
51 a1 oscil 0.3*k2, k1
52 outs a1,a1
53 endin
54
55 instr 99 ; feedback delay for bass
56 a1 delayr 0.5
57 ab deltap 0.33
58 delayw ga1 + ab*0.3
59 outs ab,ab
60 ga1 = 0
61 endin
62
63 </CsInstruments>
64 <CsScore>
65 t 0 137
66 ; ftable1 is the bass sequence to played with various swings
67 f1 0 16 -2 6.00 0 0 7.00 0 0 6.00 0 6.00 0 0 7.00 0 7.01 6.00 0
68 ; 4 measure pattern of different swinging
69 i1 0 16 0.5
70 i1 + . 0.65
71 i1 + . 0.4
72 i99 0 46
73 </CsScore>
74 </CsoundSynthesizer>