Hi, I connected my Casio Privia PX-850 to my computer and ran the MIDI Testbed (macOS) app to log MIDI messages. When I pressed down or released any key, I only got one MIKMIDIControlChangeCommand (but I expected a "Note On" and "Note Off" command).
This is what the packet looks like in the debugger:
In the code above, the packet begins with a ControlChangeCommand (\xb0) with control number 88 ('X') and value 90 ('Z'). After that, it has a NoteOnCommand (\x90) with note = 60 ('<') and velocity = 33 ('!'). So it turns out my piano is sending a "note on" command, but it is also sending a control change with it.
It looks like the problem comes from this block of code (in commandsWithMIDIPacket inside MIKMIDICommand.m) which basically ignores the MIDI messages after the first (if they are not the same type):
if (packetData[0] != firstCommandType && ((packetData[0] | 0x0F) != (firstCommandType | 0x0F))) {
// Doesn't look like multiple messages because they're not all the same type
MIKMIDICommand *command = [MIKMIDICommand commandWithMIDIPacket:inputPacket];
return command ? @[command] : @[];
}
It looks like a MIDIPacket can contain multiple messages with different types. If I comment this block out, the code works just fine and reports both the ControlChangeCommand and the NoteOnCommand. Just wondering what the reasoning for that chunk of code is. Thanks!
Hi, I connected my Casio Privia PX-850 to my computer and ran the MIDI Testbed (macOS) app to log MIDI messages. When I pressed down or released any key, I only got one MIKMIDIControlChangeCommand (but I expected a "Note On" and "Note Off" command).
This is what the packet looks like in the debugger:
In the code above, the packet begins with a ControlChangeCommand (\xb0) with control number 88 ('X') and value 90 ('Z'). After that, it has a NoteOnCommand (\x90) with note = 60 ('<') and velocity = 33 ('!'). So it turns out my piano is sending a "note on" command, but it is also sending a control change with it.
It looks like the problem comes from this block of code (in
commandsWithMIDIPacket
insideMIKMIDICommand.m
) which basically ignores the MIDI messages after the first (if they are not the same type):It looks like a MIDIPacket can contain multiple messages with different types. If I comment this block out, the code works just fine and reports both the ControlChangeCommand and the NoteOnCommand. Just wondering what the reasoning for that chunk of code is. Thanks!
EDIT: Looks like someone does have a fix for it, it just hasn't been merged yet: https://github.com/mixedinkey-opensource/MIKMIDI/pull/184
I might make a separate pull request for this.