[sdiy] Handling MIDI Running Status from Power-up

Next Expanse nextexpanse at gmail.com
Fri Nov 15 16:46:20 CET 2019


I wouldn’t say insoluble. If live patching is a hard requirement, you can
maybe relax correctness and just try and find something that works. You
can’t get channel data, but if you have multiple cables and are repatching
to route the data, then Omni mode makes sense anyway.

The heuristic would be relatively simple. Detect an unplugged cable and set
running status to unknown, in which case you’d do the following. First you
need to establish sync. Set a timer when there’s a bare data byte received,
and some time threshold indicates adjacent bytes. Figure out how long the
messages are, by maybe waiting for two subsequent messages of the same
length. If they are a single byte long, it’s aftertouch. Otherwise, keep a
history of the messages received and set another timer. If you receive two
subsequent nonzero values for the second bytes, but with the same first
byte, it’s either control change or pitch bend (since note ons will be
followed by note offs). If the first value is also changing, it’s pitch
bend, otherwise cc. If you don’t receive subsequent nonzero second bytes,
it’s note on. When the timer runs out, and/or you’ve received enough
messages to make a guess, set the running status and start interpreting the
data.

None of this is guaranteed to be correct, but if in your use case doing
something maybe wrongly is better than doing nothing correctly, then go for
it.

-E

On Thu, Nov 14, 2019 at 4:15 PM ackolonges fds <ackolonges at hotmail.com>
wrote:

> Thanks everyone for your very thoughtful and insightful responses.
>
> The reason why this issue rears its head perhaps a bit more often than
> normal in my case is that my MIDI parser is written for a Eurorack module
> that receives MIDI - an environment that invites live patching. The problem
> also occurs simply when turning on or resetting the module. Unfortunately
> I'm not creating the device that sends the MIDI, just receiving it - I've
> tried with two different MIDI keyboards, and unfortunately neither of them
> utilise active sense or have any sort of 'time-out' on their running status
> behaviour. So if it's an unsolvable problem from my end, at least I know
> that it's unsolvable for everyone and it's not just my device that exhibits
> the unexpected behaviour - in fact it's the commercial controllers' fault!
>
> If I make any MIDI *sending* devices at some stage, I'll be sure to use
> one of the great strategies mentioned - active sense, running status only
> on full buffer, or running status time-out.
>
> Thanks again for your input.
>
> ------------------------------
> *From:* Synth-diy <synth-diy-bounces at synth-diy.org> on behalf of
> music.maker at gte.net <music.maker at gte.net>
> *Sent:* Friday, November 15, 2019 2:42 AM
> *To:* synth-diy at synth-diy.org <synth-diy at synth-diy.org>
> *Subject:* Re: [sdiy] Handling MIDI Running Status from Power-up
>
>
>
> Not sure why you would be switching MIDI cables during a performance for
> exactly the reason you
> stated - running status.  Two things come to mind.  Since you're writing
> your own code, simply
> disable running status and always send status all the time.  That does
> eliminate some bandwidth
> though, so not entirely desirable.  Or you could include a switch that
> prevents running status
> while on.
>
> What I wonder though, is why you are switching MIDI cables during a
> performance?  MIDI is designed
> to accommodate many sound modules all plugged in at once.  If one MIDI bus
> is insufficient (you use
> more than 16 sources) you can use two or more interfaces.  I think this is
> the reason you don't
> find MIDI interface devices with such a switch on the market.  Not to
> mention that it's just bad
> business to disturb your rig while there's an audience waiting to hear
> you.  The god of gig is
> always watching and will strike with a broken something just at the
> "right" moment.
>
> ackolonges fds <ackolonges at hotmail.com> wrote:
> >--
>
> >I've run into a MIDI running status issue while writing and
> >testing my own MIDI parser, and I was wondering if anyone on here
> >has heard of any practical way of handling it.
> >
> >Here is the scenario: You have been playing notes on a (hardware)
> >MIDI sound module via your MIDI keyboard that makes use of
> >running status. You then power-up a second sound module, unplug
> >the MIDI cable from the previous one, and plug it into the second
> >one. When you continue playing notes, they are not received by
> >the second module, because it did not receive any status bytes
> >due to the use of running status. The only way to begin playing
> >notes with the second module is to then send another type of MIDI
> >message such as Control Change or Pitch Bend to 'break' the
> >running status, and force the sending of a new status byte - a
> >completely bewildering thing for the end user.
> >
> >I've recreated this issue on commercial synths, so it looks like
> >I'm not alone with this - have any of you encountered this
> >problem and have any ideas about an elegant way to deal with it?
> >
> >Cheers
> >
> >--_000_MEXPR01MB1960987A3276433FC603B444D5710MEXPR01MB1960ausp_
> >Content-Type: text/html; charset
> >Content-Transfer-Encoding: quoted-printable
> >
> ><html>
> ><head>
> ><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> ><style type="text/css" style="display:none;"> P
> {margin-top:0;margin-bottom:0;} </style>
> ></head>
> ><body dir="ltr">
> ><div style="font-family: Calibri, Helvetica, sans-serif;
> >font-size: 12pt; color: rgb(0, 0, 0);"> Hi All,</div> <div
> >style="font-family: Calibri, Helvetica, sans-serif; font-size:
> >12pt; color: rgb(0, 0, 0);"> <br> </div> <div style="font-family:
> >Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0,
> >0);"> I've run into a MIDI running status issue while writing and
> >testing my own MIDI parser, and I was wondering if anyone on here
> >has heard of any practical way of handling it. <br> </div> <div
> >style="font-family: Calibri, Helvetica, sans-serif; font-size:
> >12pt; color: rgb(0, 0, 0);"> <br> </div> <div style="font-family:
> >Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0,
> >0);"> Here is the scenario: You have been playing notes on a
> >(hardware) MIDI sound module via your MIDI keyboard that makes
> >use of running status. You then power-up a second sound module,
> >unplug the MIDI cable from the previous one, and plug it into the
> >second one. When you continue playing notes, they are not
> >received by the second module, because it did not receive any
> >status bytes due to the use of running status. The only way to
> >begin playing notes with the second module is to then send
> >another type of MIDI message such as Control Change or Pitch Bend
> >to 'break' the running status, and force the sending of a new
> >status byte - a completely bewildering thing for the end
> >user.<br> </div> <div style="font-family: Calibri, Helvetica,
> >sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"> <br> </div>
> ><div style="font-family: Calibri, Helvetica, sans-serif;
> >font-size: 12pt; color: rgb(0, 0, 0);"> I've recreated this issue
> >on commercial synths, so it looks like I'm not alone with this -
> >have any of you encountered this problem and have any ideas about
> >an elegant way to deal with it? <br> </div> <div
> >style="font-family: Calibri, Helvetica, sans-serif; font-size:
> >12pt; color: rgb(0, 0, 0);"> <br> </div> <div style="font-family:
> >Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0,
> >0);"> Cheers<br> </div> </body> </html>
> >
> >--_000_MEXPR01MB1960987A3276433FC603B444D5710MEXPR01MB1960ausp_--
> >
> >--=====7342240197046470926=
> >Content-Type: text/plain; charset=s-ascii"
> >MIME-Version: 1.0
> >Content-Transfer-Encoding: 7bit
> >Content-Disposition: inline
> >
> >_______________________________________________
> >Synth-diy mailing list
> >Synth-diy at synth-diy.org
> >http://synth-diy.org/mailman/listinfo/synth-diy
> >
> >--=====7342240197046470926=-
> >
>
> -- ScottG
> ________________________________________________________________________
> -- Scott Gravenhorst
> -- http://scott.joviansynth.com/
> -- When the going gets tough, the tough use the command line.
> -- Matt 21:22
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20191115/6f92a115/attachment.htm>


More information about the Synth-diy mailing list