For the upcoming App update, we had a need to have a ‘osc to (and back) MIDI bridge’. I could only find existing solutions with lots of external dependencies, so I decided to build a very lightweight daemon process with dependencies only on
libasound and C / C++ standard libs, was going to publish it together with the App update release, but here it is: https://github.com/BlokasLabs/osc2midi
At the moment it’s not making any ALSA MIDI connections there, but I’m considering extending it (or building a separate dedicated daemon) to automatically make subscriptions for every port as they appear, there are events generated by the ALSA lib when new ports appear and old ones disappear.
The reason I’m showing the osc2midi now is to demonstrate that not a lot of code is needed to work with MIDI events on Linux, the ‘port appeared / disappeared’ events could be captured to implement automatic connection making, in case of osc2midi to its own virtual ports, or in case of a generic MIDI connection manager, make the connections based on provided rules.
In our experience, the rule ‘aconnect everything to PD and PD to everything’ goes a long way, so that’s what we’d start from.
It is surprising why there’s no existing solution like that out there, or at very least it’s well hidden if it exists.