This is awesome. What’s the latency like? Is there any perceivable delay?
Latency is mostly fine for my keyboard. On my E-Piano it’s a bit worse, as the piano constantly sends masses of MIDI messages, filling some buffer and causing delays when playing notes. Haven’t investigated that yet.
Is it possible to do without usb-to-midi and to use GPIO (or UART?) for that? Receiving side will require optocoupler, a diode and a few resistors. Example of design for interfacing with midi with UART, but based on PIC. Raspberry Pi works on 3.3v, and MIDI works on 5v, but probably it doesn’t matter on receiving side, seems that 6N138 can handle that. I’m not sure about existing software that supports this; in case of using UART probably it’s possible to avoid writing kernel drivers and do everything in userspace.
Old PC soundcards had “game port” which had MIDI pins but required similar circuitry to actually connect to MIDI. I remember building receive-only adapter for game port in mid-2000s, such adapters were quite popular at the time.
I haven’t investigated this yet. It should work as long as you get the data somehow into alsa, which should be possible without touch kernel driver development. Maybe I’ll tackle this in the future :-)