Auto connect Midi with translation step

Hi folks,

Looking for some advice on the best (for me that means as simple as possible and low latency) approach to achieve the following:

  • two midi sources (akai LPD8 and korg electribe 2) to be sent to Midi out, with some modifications to the signal of each:

  • LPD8: non-zero CC values on some specific CC numbers to be converted to a value of 127.

  • electribe: midi notes from several specific channels to be merged into a single specific channel

I’m a pi beginner. So far I have managed to use aconnect to get the basic midi routing working, with the midi from the two devices being sent out from the pisound to other hardware.

Research so far to achieve the translation step and also getting it to setup automatically on each boot lead me to:

  • pure data for the midi translation (is there something more lightweight that is suitable?)

  • amidiauto or amidiminder for the automatic setup on boot (if I’ve understood correctly, I’ll need the latter in order to integrate pure data or whatever I use for the midi processing, since amidiauto won’t do a hw-sw-hw chain ?)

Am I on the right track with these thoughts?

On a more basic level, I believe I have installed amidiauto but not got it so it starts automatically, I am using Raspberry Pi OS not Patchbox and would prefer to keep on Pi OS if possible.

Thank you!

Yes, PD and one of amidiminder or amidiauto would work. amidiauto could form such a chain, but if any of your devices has more than 1 USB MIDI port, you should use amidiminder instead, otherwise they’re quite similar.

Instead of PD, if you know how to write code, you could write a Python script that uses some MIDI library like RT MIDI and performs the logic that you’re after.

Hi Giedrius,

Thanks for your reply.

Yes I know a bit of Python so would be nice to use one of those libraries to write my own solution for the midi processing.

Do you have any docs for setting up amidiauto to run automatically? (I’m new to raspberry pi, remember seeing something on this forum about needing to change some permissions on the pi somewhere?)

Do I need to get my python process sorted and running before amidiauto so that amidiauto “connects” to this process, or is that not the right way of thinking about it, and the Python process can be considered ‘independent’ of whatever amidiauto is doing?

What output does this command print?

systemctl status amidiauto

The script can get started independently from amidiauto - it monitors the MIDI ports on the system, and applies its rules as soon as new ports appear.

pi@raspberrypi:~ $ systemctl status amidiauto
● amidiauto.service - ALSA MIDI autoconnect daemon
   Loaded: loaded (/lib/systemd/system/amidiauto.service; enabled; vendor preset
   Active: active (running) since Fri 2021-11-19 14:12:33 GMT; 11min ago
 Main PID: 486 (amidiauto)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/amidiauto.service
           └─486 /usr/bin/amidiauto

Nov 19 14:12:33 raspberrypi systemd[1]: Started ALSA MIDI autoconnect daemon.
Nov 19 14:12:33 raspberrypi amidiauto[486]: Reading '/etc/amidiauto.conf' failed
Nov 19 14:12:33 raspberrypi amidiauto[486]: Allowing '*' -> '*'

I didnt hasve any sccess with amidiauto so I installed amidiminder and added the connections using aconnect, which amidiminder correctly recognised -as seen by messages in the still open terminal tab in which I had run amidiminder - but on reboot nothing is remembered. And running amidiminder does not reestablish any connections either. It says it cannot find the rules file even though there is one there [the original file].

is there perhaps something i need to do on the pi for it to be allowed to access these files? my understanding for both amidiauto and amidiminder was that they should run automatically at startup, but maybe there is some other step i have missed to make this happen and for them to see the relevant config files?