While investigating what must be added to support midi clock to earthsea’s usb midi mode I think I might have found a potential source for the glitchy midi input (on both aleph and earthsea).

The code which parses USB-MIDI event packets and turns them into internal kEventMidiPacket seems like it might have a few kinks to work out. After staring at the code for a bit I’m starting to suspect that:

  • running status isn’t handled in all cases
  • the rxBuf contains 32 bit USB-MIDI event packets yet the parsing code is only skipping over the packet header of the first event. If there are multiple event packets the headers get interpreted as if they where midi data. (see section 4 of http://www.usb.org/developers/docs/devclass_docs/midi10.pdf)

…now off to confirm my suspicions.

https://github.com/monome/aleph/blob/dev/avr32_lib/src/usb/midi/midi.c#L67-L125