[...]
Poor man's solution:
put a 'sleep 5' after starting Pd.
This of course introduces a race condition. Might almost always workâ˘.
A slightly more advanced way:
while ! aconnect --list | grep "Pure Data"; do sleep 0.1;
Put that after firing up Pd. It continues only after "Pure Data" appears in the list of available MIDI ports.
Which is much more elegant, thanks Roman. Note that this will cause confusion when more than one Pd instance is running. A possible command line flag to name a Pd instance for alsa-midi was discussed in the aforementioned thread. It seems that it did not get implemented in the end.
cheers, P