Debian Codegraph @

examples/midiin.csd

raw
1 <CsoundSynthesizer>
2
3 <CsOptions>
4 ; Select audio/midi flags here according to platform
5 ; Audio out Audio in No messages
6 -odac -iadc -d -M0 -+rtmidi=virtual ;;;RT audio I/O with MIDI in
7 ; For Non-realtime ouput leave only the line below:
8 ; -o midiin.wav -W ;;; for file output any platform
9 </CsOptions>
10
11 <CsInstruments>
12
13 sr = 44100
14 ksmps = 10
15 nchnls = 1
16
17 ; Example by schwaahed 2006
18
19 massign 0, 130 ; make sure that all channels
20 pgmassign 0, 130 ; and programs are assigned to test instr
21
22
23 instr 130
24
25 knotelength init 0
26 knoteontime init 0
27
28 kstatus, kchan, kdata1, kdata2 midiin
29
30 if (kstatus == 128) then
31 knoteofftime times
32 knotelength = knoteofftime - knoteontime
33 printks "kstatus= %d, kchan = %d, \\tnote# = %d, velocity = %d \\tNote OFF\\t%f %f\\n", 0, kstatus, kchan, kdata1,kdata2, knoteofftime, knotelength
34
35 elseif (kstatus == 144) then
36 knoteontime times
37 printks "kstatus= %d, kchan = %d, \\tnote# = %d, velocity = %d \\tNote ON\\t%f\\n", 0, kstatus, kchan, kdata1, kdata2, knoteontime
38
39
40 elseif (kstatus == 160) then
41 printks "kstatus= %d, kchan = %d, \\tkdata1 = %d, kdata2 = %d \\tPolyphonic Aftertouch\\n", 0, kstatus, kchan, kdata1, kdata2
42
43 elseif (kstatus == 176) then
44 printks "kstatus= %d, kchan = %d, \\t CC = %d, value = %d \\tControl Change\\n", 0, kstatus, kchan, kdata1, kdata2
45
46 elseif (kstatus == 192) then
47 printks "kstatus= %d, kchan = %d, \\tkdata1 = %d, kdata2 = %d \\tProgram Change\\n", 0, kstatus, kchan, kdata1, kdata2
48
49 elseif (kstatus == 208) then
50 printks "kstatus= %d, kchan = %d, \\tkdata1 = %d, kdata2 = %d \\tChannel Aftertouch\\n", 0, kstatus, kchan, kdata1, kdata2
51
52 elseif (kstatus == 224) then
53 printks "kstatus= %d, kchan = %d, \\t ( data1 , kdata2 ) = ( %d, %d )\\tPitch Bend\\n", 0, kstatus, kchan, kdata1, kdata2
54
55 endif
56
57 endin
58
59 </CsInstruments>
60
61 <CsScore>
62 i130 0 3600
63 e
64 </CsScore>
65
66 </CsoundSynthesizer>