Mixing score and midi causes midi notes sustain forever

I’m tinkering with mixing the score and live midi (using the cabbage on screen keyboard), but I’m having trouble getting both to play nicely with each other.

<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue"), pluginId("def1")
keyboard bounds(8, 158, 381, 95)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
ksmps = 32
nchnls = 2
0dbfs = 1

massign 0, 2

instr 1
    kEnv madsr .1, .2, .6, .4
    aOut vco2 p5, p4
    outs aOut*kEnv, aOut*kEnv
endin

instr 2
    kEnv madsr .1, .2, .6, .4
    aOut vco2 p5, p4
    outs aOut*kEnv, aOut*kEnv
endin


</CsInstruments>
<CsScore>
r 10
i 1 0 0.25 440 0.5
i 1 1 0.25 440 0.5
s
e
</CsScore>
</CsoundSynthesizer>

Any midi key held “over the loop” plays forever. If I replace the entire score with f0 z it works as expected. Where am I going wrong?

Thanks in advance!

I’m seeing the same thing here. I suspect it has something to with the midi interop command line flags. If I remove the --midi-key-cps=4 --midi-velocity-amp=5 it seems to work fine. You can access the incoming midi note and amplitude values using the notnum and veloc opcodes. That’s probably the simplest solution for now. :+1:

1 Like