This has been there forever, and affects all Linux systems when using ALSA MIDI devices.
sys_alsa_putmidibyte() in s_midi_alsa.c outputs individual bytes instead of complete MIDI messages. You can clearly see this, e.g., when sending a sysex message from Pd to an ALSA MIDI output and looking at the results in kmidimon. Instead of a proper sysex message you'll get a sequence of (malformed) single-byte messages.
You can't just output single bytes of a multi-byte MIDI message with snd_seq_event_output_direct(), this only works with single-byte (such as system realtime) messages. The proper way to do this, so that it works with any MIDI message, is to use snd_midi_event_encode_byte() and output the message when it's complete. The following fix is from the pd-l2ork repo, but it should apply cleanly on the current pure-data master branch:
https://github.com/pd-l2ork/pd/commit/9f5a265
Anonymous
I'm attaching this as a patch against the current master.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Out of curiosity, is it not up to the receiving device to parse the received bytes in such a way that they form a coherent message? Or is there a "timeout" after which a sysex message is considered aborted ?I don't remember the latter from the specs, so I always assumed the former.
Last edit: IOhannes m zmölnig 2016-10-16
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
AFAICT that's not the way ALSA works. I haven't really looked in the ALSA code, but it seems that assembling the MIDI messages has to be done using the corresponding sequencer API calls. There might be some drivers which handle this, but I never had this working properly when outputting sysex using either internal ALSA connections or external MIDI gear via a USB-MIDI device.
All I can say is that the suggested patch seems to be the right way to do this (those API calls are there for a reason), and that it works for me with every MIDI equipment I tried it with.
Last edit: IOhannes m zmölnig 2016-10-18
Attached a little test patch. Output from kmidimon without the patch:
And with the patch:
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
In the case of external midi it does seem that the interface makes a difference. A MOTU Miditimepiece will send sysex from pd with no problem, either thru Mac USB or even the hacked, unsupported output only linux paralel port driver. Not so with one of the old flash-firmware-at-boot Midiman interfaces, which will not send sysex at all (but will recieve it).
I can only repeat that it's not because of a shortcoming in the driver of these devices, it's just because the implementation of sys_alsa_putmidibyte() is simply wrong.
Ok, I've posted the patch, I'm sure that it's the right way to resolve this issue. I also provided a test case which demonstrates the issue. That's all I can do.
Thanks - I grabbed it from pd-llorc and applied it (then saw that you had
also stuck the patch in the bug report :)
M
On Tue, Jan 03, 2017 at 02:44:01PM +0000, Albert Graef wrote:
Related
Bugs: #1272
Thanks, works great now. :)
Now can we also get my other pet peeve fixed, the bendin issue? See #1262
Well, as the issue is fixed, maybe close it? (Can't find a way to do that myself, even though I reported the issue.)