[sdiy] MIDI velocity
rsdio at audiobanshee.com
rsdio at audiobanshee.com
Wed Apr 13 21:51:21 CEST 2016
On Apr 10, 2016, at 11:33 AM, Tom Wiltshire <tom at electricdruid.net> wrote:
> On 10 Apr 2016, at 19:09, "Richie Burnett" <rburnett at richieburnett.co.uk> wrote:
>>> Did you do the keyscanner as a separate processor then, Paul? Doesn't that
>>> re-introduce latency when you have to communicate with the main uP?
>>
>> The latency won't be much if you use a high baud rate for the communications
>> between the keyscanner and the main micro. That's what I'm going to do.
>>
>> The low data rate of MIDI is a real bottleneck for getting shot of all the
>> note events that can potentially be generated in each small time interval of
>> a fast key scanning process.
>
> I definitely agree about MIDI being the real bottleneck. You have to wait like literally *milliseconds* for anything to happen! <teenage eyeroll>
>
> I suppose if you're scanning at (say) 4KHz/250uS, then sending multibyte messages at a few MHz isn't going to hold anything up. For example, three bytes: 24 bits x 1usec = 24usecs, so we've time for ten such messages before our next scan. So SPI or even a fast serial connection between the keyscanner and the main uP looks feasible.
This is one of the reasons why MIDI bandwidth isn't usually such an issue for keyboard events (excluding aftertouch and wheel messages). I haven't done any statistical analysis, but it seems unlikely that anyone could press more than 1 key in any matrix scan time window. The older synths scanned at 1kHz/1ms and then had time enough for 1.0 to 1.5 notes (with running status) per key column. Since a typical chord might span multiple columns anyway, the CPU doesn't really need to send too many notes in any single interval.
Of course, this all falls down as soon as you start wiggling a pitch bender, mod wheel, or aftertouch sensor.
USB-MIDI has the potential for much higher bandwidth, provided there isn't a legacy serial link in the path that slows things down to classic MIDI rates. The drawback of USB-MIDI is that the latency of USB introduces a bit of jitter compared to classic MIDI. If you scan at 4kHz/250us then USB will aggregate all of the messages into a single 1ms frame at the next Host interval, with an average latency of at least 500us, if not more.
> (Incidentally, I never really understood why the MMA didn't just up the data rate of the MIDI spec back in the 90s sometime. We could have coped with "two speed" MIDI. Modern synths could have had a baud rate selector so they could talk to whatever. We manage with USB1, USB2, etc. It doesn't need a whole new spec, just the same, but faster.)
USB is a two-way serial link, with predefined master/slave (Host/Device) roles. Each Device describes its speed capabilities to the Host, and is required to operate at USB1 speeds until the Host requests faster speeds.
The beauty of MIDI is that everything works with everything. There are no switches or settings to change. Without the two-way communications abilities that USB has, "two speed" MIDI would be a p.i.t.a. because the guaranteed compatibility would be lost.
All the same, several companies came out with double-speed MIDI and even one I recall was about ten times the speed of regular MIDI. But none of this gear worked with standard keyboard controllers or sound modules.
Brian Willoughby
Sound Consulting
More information about the Synth-diy
mailing list