Cabbage Logo
Back to Cabbage Site

Midi / Cabbage/ print values


I would like to monitor some midi events :just the key pressed and particularly when a key is released for a bug tracking.
printk2 p4
printk2 p5
show the velocity and the note but does not show when the key is release.
How can I do that in cabbage in order to get an output like showing that the key has been released ? :
p4 : 60
p5 : 0.8

p4 : 60 
p5 : 0

Thanks for help

You can use the release opcode ala:

instr 1
prints "\nNote on. Freq:%4.f, Amp:%f", p4, p5

kNoteOff release
if changed:k(kNoteOff)==1 then
	printks "\nNote off", 0


Thank you a lot !

No problem, thanks for building the latest source on Windows. I’ve uploaded it and it is now available from the beta releases page.

Great !
People will be happy I hope.

About the midi bug : Somehow, all key when pressed and release indeed send a note on / note off message… but my synth from time to time continue sending audi, as if the note off was not received… this is really weird. I can’t see where this comes from.

Do you have any idea how I could debug this ?

Mmmmhhh… I don’t see the link.
Did you put it in the following post Latest beta packages available here (updated links) ?
Maybe should you also update the text ?

Hey @Karamel1,

Couldn’t it be something similar to this: Cabbage missing "note off" messages - notes stay open ?

The link is there, I replaced the old binary with the one you created. And the text is updated, from v2.20 to v2.21.

Re the MIDI bug. You could step through the following methods with the VS debugger.

That’s where the MIDI information is passed to Csound. Looks like certain note-offs are not making it through?

@gsenna, thanks for pointing to that thread, hopefully that might do the trick.


Well, I tried the @gsenna 's trick on real key board with no result.
Concerning the VS debugging : i tried but this really goes over my programming skills.
However, I manage to reproduce the bug very easily using debugger :
Start debugging, launch the instrument, load a preset.on keyboard
Play a few note to check if this woks
just put any breakpoint into the CsoundPluginProcessor::ReadMidiData function (i.e. at the return line)
play a note on the real keyboard.
remove the breakpoint and continue execution with F5… The note plays for ever. ( whene ever in the process the key has been release long time ago)

I really need help on that …
Thank you

I think that just proves what we already know, i.e, somehow, somewhere, a note off message is not getting through. I apologise for not being able to look into this at the moment. Once things settle down a little at work I should have more free time to delve into the dark world of MIDI messages!

Oh, sorry it didn’t work. This is with a real keyboard, right? Can you trigger this behavior with the virtual keyboard also? If no, then how about midi monitoring with MIDI-OX to see if the note off is there?

Could you post a minimal .csd? I can install latest Cabbage in a virtual machine after coming back from Montevideo next week and try with my Casio keyboard if you like.

Many thanks to you.
@rorywalsh : no worries, things will find a solution.

@gsenna : My keyboard is a ALESIS VI-49, I did indeed monitor with MIDI-OX . All notes are sent with a note on and a note off message. So the keyboard is not buggy.
Once I have triggered the bug with the real midi keyboard, then I can repeat it with the virtual keyboard, on the same note.

When printing all messages received by the instrument, it indeed receive all note on and note off.
I also changed the computer from my tablet to my big Tower (core i7) … I get the same trouble after a while.
It seems to me that, Cabbage forgets from time to time to send a note off to Csound. (I discovered today that there can be a residual sound with all previously played notes, as if some buffer was never cleaned, despite the fact that I clear all audio variable at the end of the instrument).

The csd and the howto are in this post : New synth beta : Morpheur
Even if it seems to be big… in fact all audio is in instr 1, the rest is for GUI and keyboard management and effects. I also tried to comment a lot… for further maintenance :smile:

Please feel to try it and thank you a lot for your help.