<div dir="ltr">The bytes all come through, but they're not being recognized as a single message. Same with other ALSA sequencer clients such as fluidsynth. Depending on the client, it will then just throw away these single byte messages or, worse, misinterpret them. I suspect that the same happens in the USB-MIDI driver.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 16, 2016 at 8:27 PM, Giulio Moro <span dir="ltr"><<a href="mailto:giuliomoro@yahoo.it" target="_blank">giuliomoro@yahoo.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:Helvetica Neue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"><div dir="ltr"><span>sorry I read your message again and found the answer to the latest question, so I have a new one, if you don't mind:</span></div><div dir="ltr"><span>in kmidimon did you see ALL of your bytes coming through or only some of them?</span></div><div dir="ltr"><span><br></span></div><div dir="ltr" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9978"><span id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9977">My point is: I believe that if you send bytes over an old-style MIDI connector, it should not matter how spaced in time they are: the receiver should be able to reconstruct the message. I expect that the same should happen for software connections. So, if bytes are dropped because of improper use of the API, then I understand the issue.</span></div><div dir="ltr" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9979"><span>But I would struggle to understand why it should fail if all the bytes are actually delivered.</span></div><div dir="ltr" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9979"><span><br></span></div><div dir="ltr" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9979"><span>I must say that a long time ago I was successfully controlling a Roland Sound Canvas over sysex generated in Pd-Extended 0.43.</span></div><div class="m_-2143836769065932298qtdSeparateBR" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9980"><br></div><div class="m_-2143836769065932298qtdSeparateBR" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9980">Best,</div><div class="m_-2143836769065932298qtdSeparateBR" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9980">Giulio<br><br></div><div class="m_-2143836769065932298yahoo_quoted" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9780" style="display:block"> <blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;margin-top:5px;padding-left:5px" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9779"> <div style="font-family:Helvetica Neue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9778"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9777"> <div dir="ltr" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9797"> <font id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9796" face="Arial" size="2"> <hr id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9798" size="1"><span class=""> <b><span style="font-weight:bold">From:</span></b> Albert Graef <<a href="mailto:aggraef@gmail.com" target="_blank">aggraef@gmail.com</a>><br> <b><span style="font-weight:bold">To:</span></b> Giulio Moro <<a href="mailto:giuliomoro@yahoo.it" target="_blank">giuliomoro@yahoo.it</a>> <br></span><b><span style="font-weight:bold">Cc:</span></b> Ticket 1272 <<a href="mailto:1272@bugs.pure-data.p.re.sf.net" target="_blank">1272@bugs.pure-data.p.re.sf.<wbr>net</a>>; "<a href="mailto:pd-dev@lists.iem.at" target="_blank">pd-dev@lists.iem.at</a>" <<a href="mailto:pd-dev@lists.iem.at" target="_blank">pd-dev@lists.iem.at</a>><br> <b><span style="font-weight:bold">Sent:</span></b> Sunday, 16 October 2016, 19:08<br> <b><span style="font-weight:bold">Subject:</span></b> Re: [PD-dev] [pure-data:bugs] #1272 midiout not working correctly on ALSA<br> </font> </div> <div class="m_-2143836769065932298y_msg_container" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9776"><br><div id="m_-2143836769065932298yiv0204593901"><div id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9775"><div><div class="h5"><div dir="ltr" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9774"><div id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9773"><div id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9795">Hi Giulio,<br clear="none"><br clear="none"></div>no, 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.<br clear="none"><br clear="none">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.<br clear="none"><br clear="none"></div>Albert</div></div></div><div class="m_-2143836769065932298yiv0204593901gmail_extra" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9791"><br clear="none"><div class="m_-2143836769065932298yiv0204593901gmail_quote" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9790"><div><div class="h5">On Sun, Oct 16, 2016 at 7:25 PM, Giulio Moro via Pd-dev <span dir="ltr"><<a rel="nofollow" shape="rect" href="mailto:pd-dev@lists.iem.at" target="_blank">pd-dev@lists.iem.at</a>></span> wrote:<br clear="none"></div></div><blockquote class="m_-2143836769065932298yiv0204593901gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9789"><div class="m_-2143836769065932298yiv0204593901yqt8863155514" id="m_-2143836769065932298yiv0204593901yqt04342"><div id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9788"><div style="color:#000;background-color:#fff;font-family:Helvetica Neue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px" id="m_-2143836769065932298yui_3_16_0_ym19_1_1476641831054_9787"><div><div class="h5"><div dir="ltr">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 ?</div><div dir="ltr">I don't remember the latter from the specs, so I always assumed the former.</div><div dir="ltr">Giulio</div><div class="m_-2143836769065932298yiv0204593901m_-3706118979231101611qtdSeparateBR" id="m_-2143836769065932298yiv0204593901m_-3706118979231101611yui_3_16_0_ym19_1_1476612301832_102390"><br clear="none"><br clear="none"></div></div></div><div class="m_-2143836769065932298yiv0204593901m_-3706118979231101611yahoo_quoted" id="m_-2143836769065932298yiv0204593901m_-3706118979231101611yui_3_16_0_ym19_1_1476612301832_102243" style="display:block"> <blockquote id="m_-2143836769065932298yiv0204593901m_-3706118979231101611yui_3_16_0_ym19_1_1476612301832_102242" style="border-left:2px solid rgb(16,16,255);margin-left:5px;margin-top:5px;padding-left:5px"> <div id="m_-2143836769065932298yiv0204593901m_-3706118979231101611yui_3_16_0_ym19_1_1476612301832_102241" style="font-family:Helvetica Neue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"> <div id="m_-2143836769065932298yiv0204593901m_-3706118979231101611yui_3_16_0_ym19_1_1476612301832_102240" style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"><div><div class="h5"> <div dir="ltr" id="m_-2143836769065932298yiv0204593901m_-3706118979231101611yui_3_16_0_ym19_1_1476612301832_102388"> <font face="Arial" size="2"> </font><hr size="1"> <b><span style="font-weight:bold">From:</span></b> Albert Graef <<a rel="nofollow" shape="rect" href="mailto:agraef@users.sf.net" target="_blank">agraef@users.sf.net</a>><br clear="none"> <b><span style="font-weight:bold">To:</span></b> <a rel="nofollow" shape="rect" href="mailto:pd-dev@lists.iem.at" target="_blank">pd-dev@lists.iem.at</a> <br clear="none"> <b><span style="font-weight:bold">Sent:</span></b> Sunday, 16 October 2016, 18:17<br clear="none"> <b><span style="font-weight:bold">Subject:</span></b> [PD-dev] [pure-data:bugs] #1272 midiout not working correctly on     ALSA<br clear="none">  </div> </div></div><div class="m_-2143836769065932298yiv0204593901m_-3706118979231101611y_msg_container" id="m_-2143836769065932298yiv0204593901m_-3706118979231101611yui_3_16_0_ym19_1_1476612301832_102239"><br clear="none"><div id="m_-2143836769065932298yiv0204593901m_-3706118979231101611yiv8365498489"><div class="m_-2143836769065932298yiv0204593901m_-3706118979231101611yiv8365498489markdown_content" id="m_-2143836769065932298yiv0204593901m_-3706118979231101611yui_3_16_0_ym19_1_1476612301832_102238"><div><div class="h5"><span class="m_-2143836769065932298yiv0204593901"></span><hr>
<div id="m_-2143836769065932298yiv0204593901m_-3706118979231101611yui_3_16_0_ym19_1_1476612301832_102237"><strong> <a rel="nofollow" shape="rect" class="m_-2143836769065932298yiv0204593901m_-3706118979231101611yiv8365498489alink" href="https://sourceforge.net/p/pure-data/bugs/1272/" target="_blank">[bugs:#1272]</a> midiout not working correctly on ALSA</strong></div>
<div id="m_-2143836769065932298yiv0204593901m_-3706118979231101611yui_3_16_0_ym19_1_1476612301832_102314"><strong>Status:</strong> open<br clear="none">
<strong>Group:</strong> v0.47<br clear="none">
<strong>Created:</strong> Sun Oct 16, 2016 05:17 PM UTC by Albert Graef<br clear="none">
<strong>Last Updated:</strong> Sun Oct 16, 2016 05:17 PM UTC<br clear="none">
<strong>Owner:</strong> Miller Puckette</div>
<div>This has been there forever, and affects all Linux systems when using ALSA MIDI devices.</div>
<div>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.</div>
<div>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:<br clear="none">
<a rel="nofollow" shape="rect" href="https://github.com/pd-l2ork/pd/commit/9f5a265" target="_blank">https://github.com/pd-l2ork/ pd/commit/9f5a265</a></div>
<hr>
<span class="m_-2143836769065932298yiv0204593901"></span><div>Sent from <a rel="nofollow" shape="rect" href="http://sourceforge.net/" target="_blank">sourceforge.net</a> because <a rel="nofollow" shape="rect" href="mailto:pd-dev@lists.iem.at" target="_blank">pd-dev@lists.iem.at</a> is subscribed to <a rel="nofollow" shape="rect" href="https://sourceforge.net/p/pure-data/bugs/" target="_blank">https://sourceforge.net/p/ pure-data/bugs/</a></div>
</div></div><div>To unsubscribe from further messages, a project admin can change settings at <a rel="nofollow" shape="rect" href="https://sourceforge.net/p/pure-data/admin/bugs/options." target="_blank">https://sourceforge.net/p/ pure-data/admin/bugs/options.</a>  Or, if this is a mailing list, you can unsubscribe from the mailing list.</div></div></div><span class=""><br clear="none">______________________________ _________________<br clear="none">Pd-dev mailing list<br clear="none"><a rel="nofollow" shape="rect" href="mailto:Pd-dev@lists.iem.at" target="_blank">Pd-dev@lists.iem.at</a><br clear="none"><a rel="nofollow" shape="rect" href="https://lists.puredata.info/listinfo/pd-dev" target="_blank">https://lists.puredata.info/ listinfo/pd-dev</a><br clear="none"><br clear="none"><br clear="none"></span></div> </div> </div> </blockquote> </div></div></div></div><span class=""><br clear="none">______________________________ _________________<br clear="none">
Pd-dev mailing list<br clear="none">
<a rel="nofollow" shape="rect" href="mailto:Pd-dev@lists.iem.at" target="_blank">Pd-dev@lists.iem.at</a><br clear="none">
<a rel="nofollow" shape="rect" href="https://lists.puredata.info/listinfo/pd-dev" target="_blank">https://lists.puredata.info/ listinfo/pd-dev</a><br clear="none">
<br clear="none"></span></blockquote></div><br clear="none"><br clear="all"><br clear="none"><span class="">-- <br clear="none"><div class="m_-2143836769065932298yiv0204593901gmail_signature"><div dir="ltr">Dr. Albert Gr"af<br clear="none">Computer Music Research Group, JGU Mainz, Germany<br clear="none">Email:  <a rel="nofollow" shape="rect" href="mailto:aggraef@gmail.com" target="_blank">aggraef@gmail.com</a><br clear="none">WWW:    <a rel="nofollow" shape="rect" href="https://plus.google.com/+AlbertGraef" target="_blank">https://plus.google.com/+<wbr>AlbertGraef</a></div></div>
</span></div></div></div><br><br></div> </div> </div> </blockquote> </div></div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Dr. Albert Gr"af<br>Computer Music Research Group, JGU Mainz, Germany<br>Email:  <a href="mailto:aggraef@gmail.com" target="_blank">aggraef@gmail.com</a><br>WWW:    <a href="https://plus.google.com/+AlbertGraef" target="_blank">https://plus.google.com/+AlbertGraef</a></div></div>
</div>