I modified ttyMIDI to work with Bela - here's the Github repo.
There are some significant differences - all the CLI arguments are hardcoded macros, including the desired UART port, and the program only reads MIDI. I'm sure MIDI output could be re-implemented if desired by referencing the original code, and I removed the argparser to streamline the program for my specific use case. But it works great - I've got my Bela Mini receiving MIDI data from a controller connected with a 5-pin DIN jack on a breadboard without any glitches. You need to make sure UART4 is enabled and configured, using
config-pin or loading the proper device tree overlay, or you can change the port by changing the file path in the
My question now is how I can integrate this with a Bela program. Ideally I could pass the MIDI port that ttyMIDI generates to the MIDI parser from the Bela MIDI library, which appears to take an ALSA hardware address (I could be wrong though.) When I run
aconnect -i with ttyMIDI running, I see the MIDI device listed, I'm just not sure how to specify that device in the Bela project.
Also @giuliomoro if you have advice on the best way to run the program at startup, that would be wonderful.