[LAD] MIDI-2-TCP, TCP-2-MIDI

Len Ovens len at ovenwerks.net
Mon Sep 3 23:57:17 CEST 2018


On Mon, 3 Sep 2018, Jonathan E. Brickman wrote:

> Indeed, MIDI's 31.25 kbps gives (because of its 8+2 bit protocol) a rough upper
> cap of 1500+ datacommands (including notes and timing blips...) per second, notes
> being one byte per command, one more for value. And even if we use the old (and
> lately often obsolete) 50% rule, that's still 750+ items per second.  

A note on or note off is three bytes, chanel/command, note and velocity. 
Running status (first byte doesn't change from event to event) allows a 
second note on in the same chanel to omit the first byte. This is why some 
controllers send note off as a note on with velocity 0. Using note on and 
note off means note, release, note is 9 bytes rather than 7 bytes for note 
on on_with_0_velocity, on. Anyway, 1k is about the highest one can expect 
on a per event basis. "Realtime" events are single byte and patch events 
are two bytes. rpn and nrpn events are a minimum of 9 - 12 bytes for the 
first one sent but may be a little as 3 for a next value.... though good 
practice pretty much demands sending the whole 12 bytes every time.

Jack always converts incoming midi to full three byte events. I do not 
know if it sends using running status to hardware devices.

All midi "mixing" requires converting to full events as well as queuing 
bytes event at a time.

> It would certainly be nice to blow all of those numbers away by two or three
> orders of magnitude! And it would be gorgeous to have MIDI data simply pervade an
> IP stage network, or an IP instrument network, or one multi-instrument box
> through localhost, or a stack-of-Raspberry-Pis network, or a creative combo. I
> don't like the idea of using CAT5e generally on stage, because MIDI DINs are just

There are high use/cycle cat connectors and cables designed for this kind 
of use. Take a look at almost anyone who sells network snakes or stage boxes. 
Most of these cables are 100 foot cables :) but I am sure shorter cables 
(or longer) can be had. Yes this would mean adding the matching connectors 
on each of the boxes you wanted to connect.

> In the last day or two I have been playing with the Mido library's documentation
> examples, and just now found much more apparently practical examples:
> 
> https://github.com/olemb/mido/tree/master/examples
> 
> including what looks like two actual JACK<-->RTP-MIDI bridges in the 'ports' and
> 'sockets' subsections. Will be studying. Seeking much input :-)

It would be interesting to know what the throughput and latency is with 
that setup. I have never thought of python as being particularly great for 
real time applications. However, something that works is a great start. 
The road from python to c or c++ is not too bumpy depending on the 
librarys used.

--
Len Ovens
www.ovenwerks.net


More information about the Linux-audio-dev mailing list