[sdiy] Techniques for Multiplying MIDI Clock frequency?

Mike Bryant mbryant at futurehorizons.com
Fri Dec 24 01:33:49 CET 2021

Even with the latest spec, the MIDI Association go out of their way not to specify the USB speed required even in Version 2.0 of the USB Device Class Definition for MIDI devices, but I don't think you could implement most of the features of MIDI 2.0 without USB2.0 or Ethernet. 

The 1999 spec was written assuming most people were going to multiplex DIN MIDI channels onto a USB link, but I think we've moved on from that nowadays and the high bandwidth mechanism is regularly used.  A lot of kit doesn't even come with a DIN socket on it nowadays, something I've heard Rick Wakeman ranting about :-)

I've never seen anything official saying MIDI 1.0 isn't allowed over low speed USB.  Low speed USB often implements a superset of the basic spec, including extra endpoints, and so it actually often works with a single device.  But the latency is high.

My reference to USB2.0 was about using hubs to allow lots of MIDI devices to be connected.  Ideally you need a hub with a Transaction Translator per port which retimes the MIDI data onto the USB2.0 stream.  The MIDI data obviously won't be any faster than when it left the USB MIDI device, but this allows the streams to be multiplexed more efficiently so you don't have any added latency unless you are multiplexing a pretty large number of active ports.  But cheaper hubs actually slow down to the speed of the inputs and multiplexing lots of devices becomes a bad move.  Easiest way to avoid this problem is to buy a USB3.0 hub as they always seem to do things on a per port basis.

A lot of MIDI hosts and devices nowadays are actually phones/tablets operating in MIDI mode, either over USB or BLE, and the speeds required are rising all the time as more complex messages are sent.

I tend to use a bare metal USB stack for Raspberry Pi CM4s as it handles pluging/unplugging of multiple devices well, something many stacks seem to fall over on, or at least ignore any device once it has been unplugged.

-----Original Message-----
From: Brian Willoughby [mailto:brianw at audiobanshee.com] 
Sent: 23 December 2021 23:31
To: Mike Bryant
Cc: synth-diy at synth-diy.org
Subject: Re: [sdiy] Techniques for Multiplying MIDI Clock frequency?

Are you sure about all of those details, Mike?

The USB-MIDI specification does not have any mention of USB 2. My recollection is that USB-MIDI started out as requiring Full Speed clock rates, and this was not increased when faster USB clock rates were added. There is only USB-MIDI 1.0 and it has not been improved - most likely because there is so much existing support for USB-MIDI 1.0 that any "improvements" would simply break compatibility.

Also, USB 1 includes both Low Speed and Full Speed. While you are correct that Low Speed is actually worse than Classic MIDI, there has never been a USB-MIDI specification that allowed for the use of Low Speed. So, while it's possible for some devices to "fall back" to Low Speed mode, that should not be allowed for a USB-MIDI device. I looked for this to be spelled out in the USB-MIDI 1.0 spec, but I couldn't find anything quickly - it might boil down to the use of Bulk endpoints, which aren't allowed for Low Speed, or perhaps just that USB-MIDI has too many endpoints beyond what Low Speed allows.

USB 2.0 added High Speed, which happens to be backwards-compatible with Full Speed USB 1.0 devices, including USB-MIDI. So, while a USB 2.0 hub might allow more devices to be attached, it's not actually going to make the USB-MIDI devices run any faster. At best, USB 2.0 reduces the bandwidth interference from other devices, which makes it more likely that USB-MIDI Interrupt endpoints will be serviced in a timely fashion. Since USB-MIDI doesn't use the bandwidth and latency guarantees of Isochronous endpoints, the resulting latency depends entirely upon the Host operating system scheduling of Interrupt endpoints.

I've written a few USB-MIDI firmwares, so I've experimented with what's possible here. In the early days, there were many bugs in vendor examples, but over time those have gotten a lot better. Some chips have a USB stack that's flawless, but it's difficult to know that until you use it.

On Dec 20, 2021, at 09:34, Mike Bryant <mbryant at futurehorizons.com> wrote:
> Totally agree some USB stacks for MIDI are useless (Linux/ALSA anybody) but that doesn't damn USB itself.   MIDI2.0 depends on using USB (or Ethernet) and even on original MIDI it gives far better performance provided you have use USB2.0.  
> But USB 1 is actually worse than 5 pin DIN so make sure it isn't falling back into that.
> -----Original Message-----
> From: MTG
> Sent: 20 December 2021 17:27
> USB-MIDI is another layer (of hell). I don't think it's going to solve any issues that 5-pin DIN has. Maybe because the microcontrollers that have USB are typically many, many times faster than an old 8-bit one though. OTOH, some USB stacks are very poorly written.
> On 12/20/2021 8:55 AM, Benjamin Tremblay via Synth-diy wrote:
>> I finally bought a mini scope. I have no excuse not to use it.
>> I agree, this is not a hard limitation on 5 pin MIDI, but it’s too 
>> easy for developers interested in performance to abandon it and move to USB.

More information about the Synth-diy mailing list