Debian Codegraph @

iOS/Csound iOS Obj-C Examples/Csound iOS Examples/ViewControllers/MidiTest/midiTest.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -o dac
4 -M0
5 -d
6 </CsOptions>
7 <CsInstruments>
8
9 sr = 44100
10 ksmps = 64
11 nchnls = 2
12 0dbfs = 1
13
14 massign 0, 1
15
16 ga1 init 0
17
18
19 opcode cpsmid, k, k
20
21 kmid xin
22
23 #define MIDI2CPS(xmidi) # (440.0*exp(log(2.0)*(($xmidi)-69.0)/12.0)) #
24 kcps = $MIDI2CPS(kmid)
25
26 xout kcps
27
28 endop
29
30
31 instr 1
32
33 midinoteonkey p4, p5
34
35 kpch cpsmid p4
36
37 iattack chnget "attack"
38 idecay chnget "decay"
39 isustain chnget "sustain"
40 irelease chnget "release"
41
42 k2 linsegr 0, iattack, 1, idecay, isustain, irelease, 0
43 a1 vco2 k2 * .2, kpch
44
45 ga1 = ga1 + a1
46
47 endin
48
49 instr 2
50
51 kcutoff chnget "cutoff"
52 kresonance chnget "resonance"
53
54 a1 moogladder ga1, kcutoff, kresonance
55
56 aL, aR reverbsc a1, a1, .72, 5000
57
58 outs aL, aR
59
60 ga1 = 0
61
62 endin
63
64 instr allNotesOff
65 turnoff2 1, 0, 1
66 turnoff
67 endin
68
69 </CsInstruments>
70 <CsScore>
71 f1 0 16384 10 1
72
73 i2 0 360000
74
75 </CsScore>
76 </CsoundSynthesizer>