3 ms·
Also, MIDI has the nice, round speed of 31,250 bps. Since it uses start and stop bits, that's 3,125 bytes per second. A "note on" message to start playing a not
by kstrauser 7y ago
Also, MIDI has the nice, round speed of 31,250 bps. Since it uses start and stop bits, that's 3,125 bytes per second. A "note on" message to start playing a note is three bytes long: a 4 bit "this is a note on" field, followed by a 4 bit MIDI channel number, then an 8 bit note number, then an 8 bit velocity ("how hard I hit the key") number. "Note off" messages, sent when you want to stop playing a note, is identical except for the first 4 bit status field. So, if everything's perfect, playing and releasing one single note will take 6 bytes out of the available 3,125 available each second, or 1.92ms. That's why a lot of so-called "black MIDI" songs are probably literally unplayable through an actual hardware MIDI interface.
But forget about playing and releasing notes. Say you're triggering a MIDI drum machine and a synth. Sounds like violins have a slow "attack" - that is, you don't go instantly from "no sound" to "full sound", but ramp up over a short interval. Imagine a violinist that has to start moving their bow, or a trumpeter that has to start blowing. It doesn't matter if you send a synthesizer a set of "note on" messages saying "play a middle C major chord" for violin sounds and they don't all get there simultaneously, because it was going to take them all a little bit to start playing anyway. Drums are a different story. If you expect a kick and hi-hat to play at exactly the same time, you don't have that many milliseconds between their starts before a normal human listener can start to really notice it.
So, the worst case scenario is that you'd have a piece of sequenced music that plays two drums, a piano chord, a bass line, and a violin chord at the same time. This is were sound engineers start getting hyper nitpicky about stringing the equipment together so that:
- The two drums fire off in adjacent time slices so that they sound as simultaneous as possible.
- The piano notes come next, from lowest (because if it's a sampled sound, low notes will be played back more slowly and therefore have a slower attack) to highest.
- The bass sound comes next because those don't usually have a super aggressive attack.
- Violins come last, and it doesn't really matter because they're lazy and they'll take a few hundred milliseconds to really kick in anyway.
The worst case scenario is:
- One drum fires off.
- The rest of the instruments fire off in reverse order of their attacks, like high piano, bass, high violin; medium piano, medium violin; low piano, low violin.
- The other drum fires off.
Because MIDI is so glacially slow compared to every other protocol commonly used, it's going to sound absolutely terrible.
MIDI is amazing in so many way, but it has some very severe technical limitations by modern standards. I can't believe it's taken this long for a replacement to come along.
- phlakaton 7y agoWe used to deal with the serial problem using a hack: bump events back/forward by one or two quantums of time to ensure that they go out over the wire in the order that you want. It's laborious and I am looking forward to the next generation never having to worry about it. (That _will_ be fixed, right?)
- kazinator 7y agoIf you really had to send the data from multiple sources into a single MIDI destination over a single cable, then if a small global delay were acceptable, a smart scheduling algorithm with a 10-20 millisecond jitter buffer would probably take pretty good care of it so that the upstream data wouldn't have to be tweaked. (Note that if you stand with your guitar 5 meters from your 4x12 stack, you're hearing a 15 ms delay due to the speed of sound.)
- phlakaton 7y agoUnfortunately, because of the differences in instrument attack, which a MIDI controller would have almost no knowledge of, I think a random jitter would not fix the issue.
- kazinator 7y agoAn interrupt controller has no knowledge of device semantics; it can just prioritize them based on a simple priority value. The scheduler could do the same thing. It could even be configuration-free by using some convention, like lower instrument numbers have higher priority. Also, the physical layer of MIDI could simply be extended into higher baud rates while all else stays the same. I can't remember the last time I used a serial line to an embedded system in the last 15 years that wasn't pegged to 115 kbps. Bit rate is a relatively trivial parameter in serial communication; it doesn't give rise to a full blown different protocol. 115 kbps is almost four times faster than MIDI's 31250. Plain serial communication can go even faster. The current-loop style signaling in MIDI is robust against noise and good for distance. 400 kbps MIDI seems quite realistic. This would just be used for multiplexed traffic, like sequencer to synth; no need for it from an individual instrument or controller.