I've built 3 small Pd patches to fit in my workflow, e.g. to convert one MIDI controller's messages into OSC, one to light up the LEDs of another controller, one to control a pedal, etc.
If I open 2 instances of Pd, each with its own MIDI (or audio, for that matter) inputs and outputs, Alsa-Midi refers to them as follows:
$ aconnect -l client 128: 'Pure Data' [type=user,pid=260121] 0 'Pure Data Midi-In 1' 1 'Pure Data Midi-Out 1' client 129: 'Pure Data' [type=user,pid=260548] 0 'Pure Data Midi-In 1' 1 'Pure Data Midi-Out 1' 2 'Pure Data Midi-Out 2'
The client name is the same, and the client ID cannot be predicted - depending on which controllers I have plugged in and in which order, it might be any number incremented from 128. The tools that should remember and restore the patching (
jack_patch, Ray Session and the like) struggle the same as I do to figure out which instance of Pd to connect to which controllers.
I want to keep these patches in separate PD instances so I can mix and match, and not necessarily have all of them open, and always rely on the specific instance's MIDI input number and output number.
So, here's my question: any idea if it is possible to rename Pd's alsa-midi ports? I found surprisingly little online about this issue, yet I can't really believe that nobody met this issue before...
I've never seen the command line option
-jackname to actually have an effect, but in any case Pd does not use Jack MIDI as far as I understand.
I've been thinking about running the patch in a libpd wrapper instead, e.g. from a Python script in which I could specify the client's and port names, but I'm struggling a bit to install pylibpd.