Hello Rory
What’s wrong with this code. Can’t monitor midi signal. No input or output midi ?
Thanks
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 0
0dbfs = 1
instr 1
kOutputChannel init 1
kNoteOnChan[] init 127
; read midi input data
kStatus, kChannel, kData1, kData2 midiin
; if midicc signal and midicc value = 32
if (kStatus == 176 && kData1 == 32) then
; save new midi channel = midicc value
kOutputChannel = kData2
; route new midi channel
kChannel = kOutputChannel
; if midi noteOn
elseif kData1 = 144 then
; midi channel note = kOutputChannel
kChannel = kOutputChannel
; save midi channel for current midi NoteOn (needs for NoteOff later)
kNoteOnChan[kData1] = kOutputChannel
; if midi noteOff
elseif kStatus == 128 then
; read correspondaing noteOn midi chan used
kChannel = kNoteOnChan[kData1]
endif
; send midi output data
midiout kStatus, kChannel, kData1, kData2
endin
</CsInstruments>
<CsScore>
; Initialize MIDI input
i 1 0 -1
</CsScore>
</CsoundSynthesizer>