I am using a KORG nanoKONTROL2 controller and wanted to control the LEDs from an instrument by midiout. I did not get this to work, so I wrote a small test file:
form caption("Untitled") size(400, 300), guiMode("queue"), pluginId("def1")
keyboard bounds(8, 158, 381, 95)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
; These options allow controlling the LEDs but do not trigger instrument 1 from MIDI:
; -n -d -M0 -m0d -Q2
; Standard Cabbage options: trigger the instrument, but don't control the LEDs:
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
;instrument will be triggered by keyboard widget
instr 1
kEnv madsr .1, .2, .6, .4
aOut vco2 p5, p4
outs aOut*kEnv, aOut*kEnv
endin
instr 99
kstatus, kchan, kdata1, kdata2 midiin
if kstatus!=0 then
printks "Status: %i, Channel: %i, Data1: %i, Data2: %i\n", 0, kstatus, kchan, kdata1, kdata2
endif
midiout 176, 7, 32, p4
endin
</CsInstruments>
<CsScore>
i99 0 1 127
i99 1 100 0
</CsScore>
</CsoundSynthesizer>
There is one MIDI-playable instrument (1) and another one (99) which is played from the score and should switch an LED on/off by midiout
. The latter also monitors all incoming MIDI messages by midiin
and prints them to the console.
What I noticed is that if I use the standard Cabbage options for Csound instrument 1 plays but the LED is not activated. (I checked that in the Cabbage settings MIDI Output is set to “nanoKONTROL2 1 CTRL”.) But the midiin
works.
After some fiddling I found that removing -+rtmidi=NULL
from the options and adding -Q2
for assigning the MIDI output lets me control the LED. But then instrument 1 cannot be played from MIDI anymore.
I tried to find a combination of options which work for both with no avail.
[I am not sure whether this is really a bug. I don’t fully understand the MIDI assigment mechanisms of Csound and Cabbage. So it may simply be that I am not using the right options.]