Debian Codegraph @

src/Examples/FLOSS Manual Examples/07 MIDI/07A01_midiin_print.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -Ma -m128
4 ; activates all midi devices, suppress note printings
5 </CsOptions>
6 <CsInstruments>
7 ; no audio so 'sr' or 'nchnls' aren't relevant
8 ksmps = 32
9
10 ; using massign with these arguments disables default instrument triggering
11 massign 0,0
12
13 instr 1
14 kstatus, kchan, kdata1, kdata2 midiin ;read in midi
15 ktrigger changed kstatus, kchan, kdata1, kdata2 ;trigger if midi data change
16 if ktrigger=1 && kstatus!=0 then ;if status byte is non-zero...
17 ; -- print midi data to the terminal with formatting --
18 printks "status:%d%tchannel:%d%tdata1:%d%tdata2:%d%n",
19 0,kstatus,kchan,kdata1,kdata2
20 endif
21 endin
22
23 </CsInstruments>
24 <CsScore>
25 i 1 0 3600 ; instr 1 plays for 1 hour
26 </CsScore>
27 </CsoundSynthesizer>
28 ;example by Iain McCurdy