Midi connection manager

hey there, after a couple of failing hours i registered here to hopefully get my problems out of the way.

i‘m trying to headless connect different usb gear but i have zero luck. i tried to connect it via amidiauto and the amidiauto.conf route, but nothing seems to work. its starts with aconnect -li where my devices have longer names. in my case i try to connect the squarp pyramid with the minilogue. the client names are already a bit confusing:

client 28: ‘Pyramid MIDI USB’
0 ‘Pyramid MIDI USB MIDI 1’

and for the minilogue:

client 20: ‘minilogue’
0 ‘minilogue MIDI 1’
1 ‘minilogue MIDI 2’

not sure which one is the right one. i guess i tried them all already in the amidiauto.conf:

[allow]
*<->*
Pyramid USB MIDI <-> minilogue

(and every other combination i can think of).

strangly, when i try to connect them via:
aconnect ”Pyramid“ ”minilogue:1”
it works just fine.

it feels like my config file is not recognized or something, i can literally write anything in it and nothing yields problems.

would anyone be so kind and enlighten me? tried pretty much everything from this thread :frowning:

You have to restart the amdiiauto service every time you change the config - it doesn’t autodetect changes. You can restart it by running:

sudo systemctl restart amidiauto

Also, it may output something useful in its log, you can see it by running:

sudo journalctl -u amidiauto

Press ‘end’ button on the keyboard to go to the latest log lines.

Btw, a space on both sides of the <-> could be necessary. :slight_smile:

If I remember right, ALSA uses substrings to match for device names, the first one it finds that fits the substring is the one it uses, so this way, you may use partial names in the config.

thank you for your quick response - have to give away that you seem very patient and nice, seldom nowdays, thanks for that as well.

back to my still unsolved problem:

after changing the config i always restarted the service. the log does not spit out much:

patchbox systemd[1]: started ALSA MIDI autocomnect daemon.

i also have spaces between the hardware names.

another thing to mention: i only use the shell and no other software is started. maybe that is the problem? also, i‘m not really good at linux, googling my way around, but is ist somehow possible to change the path to the .conf or feed it to amidiauto when starting?

it seems like its not recognizing the conf (i assume that it should throw some errors in the log if i enter gibberish into the amidiauto.conf?)

one last thing to note, i write the outputs with my phone (got no internet connection on the pi) so theres a chance for typos in my code-posts.

thanks in advance for reading this!!

One more thing to check is the version of amidiauto - I think the one that is published in the Patchbox OS image is 1.00, while rule parsing appeared in 1.01. You can check the version using:

amidiauto -v

You can update it by running:

sudo apt-get update && sudo apt-get install amidiauto

sadly i am already on 1.01. got the latest patchbox three days ago. also tried to update via apt-get. is there maybe a way to export aconnects current connections to the amidiauto.conf?

The 1.01 version should print Reading rules in '...' in its log output.

You may try to manually run amidiauto to get the full output instead of going through journalctl, which buffers the logs and the latest lines may not be available immediately until there’s more output or some time has passed.

To run amidiauto manually, first stop and disable the service:

sudo systemctl disable amidiauto
sudo systemctl stop amidiauto

Then simply run amidiauto with no arguments, hit Ctrl+C to quit.

Btw, what is the output of which amidiauto?

so, i could resolve my problems. apt-get was not working, as it was using my ethernet connection which did not have internet access. by disabling eth0 i was able to use wlan0s internet connection. the strange thing was, that apt-get yielded that i’m already on the latest amidiauto (1.0.-1) so i was confused.

now everything seems to work fine except one thing:

i try to connect the minilogue over usb, problem is, minilogue has two midi devices in one client. the first one is the physical in and out ports of the machine, the second is for midi over usb.

client 20: 'minilogue' [type=Kernel,card=1]
    0 'minilogue MIDI 1'
        verbunden zu: 128:0[real:0], 28:0
        verbunden von: 128:0, 28:0
    1 'minilogue MIDI 2'
        verbunden zu: 128:0[real:0]
        verbunden von: 128:0

how do i connect it to the second client / device?
i tried almost anything in the amidiauto.conf, but was only able to connect to the first device / client.

is there a trick for that?

The current implementation of amidiauto works only with the very first port of a client. (this is to avoid making too many connections automatically, like Super Collider creates 4 or 8 ports, connecting a MIDI keyboard to all of them while having some synth patch would mean same note would cause 4 or 8 notes to be generated). I am considering expanding the configuration file to allow specifying the port ID as well, but can’t promise any estimate of when I’ll get to actually do it. Knowing that there’s interest in it will help give it a higher priority though. :slight_smile:

In the mean time, for your particular case, I think you could write a ‘udev’ rule that gets executed every time your minilogue gets attached to the system and you may make it run some desired aconnect command to make the connections. I haven’t done this myself, but I’m pretty sure you should be able to find some useful info on the internet.

The package manager keeps a database of what software is available and its versions, it gets updated when running sudo apt-get update, so if it wasn’t run or was unsuccessful due to no access to the internet or other reasons, then it would be using whatever information it had at the time when trying to install/update software.

1 Like

can’t thank you more, udev fixed the last missing bit in completing my setup! :slight_smile:

maybe interesting for others:

to create a udev rule you need to know some ids of your device. i used lsusb to find out idVendor and idProduct of the minilogue (Bus 001 Device 009: ID 0944:012c KORG, Inc.) where the first part of the 8 digit id is idVendor and the second part idProduct).

then i created the file /etc/udev/rules.d/50-minilogue.rules with the following contents:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0944", ATTR{idProduct}=="012c", RUN+="/usr/bin/aconnect Pyramid minilogue:1"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0944", ATTR{idProduct}=="012c", RUN+="/usr/bin/aconnect minilogue:1 Pyramid"

and all the magic will be done when you connect the device.

once again, @Giedrius can’t thank you more for your patience. big ups!

2 Likes

Any news on amidiauto to control the default midi port?
Pd: Thank you so much for amidiauto, It´s a must have tool!!!

Do you mean the specifying of port index? If so, then no, not yet… :slight_smile:

Hi everyone
So I tried unsuccessfully to establish a MIDI connection between my Korg Minilogue and Puredata on Norns / Fates
I tried this method:

aconnect 20:1 129:1
aconnect 129:0 20:1

here is the message that is returned

Schermata 2020-06-10 alle 08.12.45

But no worked. I have tried all the methods listed above. at this point i was wondering how to handle these exceptions on norns / fates since I can’t find the udev folder where to insert the rule.

if anyone could help me out I would be grateful
Thanks in advance

Hey, try to swap the arguments:

aconnect 20:1 129:0
aconnect 129:1 20:1

See https://www.spinics.net/lists/linux-audio-users/msg67252.html for explanation.

Thanks:)))) Is all ok

1 Like

Thank you for this great idea and tool. This adds plug&play to any MIDI setup :slight_smile:
I am using it to interconnect mostly hardware.

I faced these hurdles:

  1. I have 2 identical MIDI controllers. They are both named identical.

    I changed one card ID with this method https://www.alsa-project.org/wiki/Changing_card_IDs_with_udev - the device gets the ID and is shown e.g. in /proc/asound/<my id> and /sys/devices/.../sound/card?/id or aplay -L but it does not seem to be recognized for use with MIDI, e.g. with aplaymidi -p .... I haven’t found a solution for that yet.

  2. I’d like to address subclients, like @rnzr. amidi -l looks like this:

    IO  hw:5,0,0  minilogue MIDI 1
    IO  hw:5,0,1  minilogue MIDI 2
    

    I understand that this is currently not possible. I peeked at the code and opened a Github issue https://github.com/BlokasLabs/amidiauto/issues/2 to discuss what we could do about it.

  3. Unfortunately I have a “Circuit” and a “Circuit Mono Station” :wink:

    IO  hw:0,0,0  Circuit Mono Station MIDI 1
    IO  hw:4,0,0  Circuit MIDI 1
    

    This rule UMC204HD -> Circuit would match the Circuit Mono Station, too. I added an issue here for discussion, too: https://github.com/BlokasLabs/amidiauto/issues/3

Thank you for this program and for making it open! If we find a nice concept, I am able to provide pull requests.

Good timing, @mrzero has just recently shared his Amidiminder utility project. :slight_smile: It should help in the mean time.

We were planning to develop a new version of amidiauto, so it works well with multi-port devices. We’ll keep in mind the issues you reported, thank you!

1 Like

I put this in my .conf, started/enabled/disabled and nothing connects.
I spend hours on this thread as a noob…

[allow]
#Deluge MIDI 1 -> NDLR MIDI 1
24:0 -> 32:0
#Deluge MIDI 1 -> Midihub MH-2KMG9CN MIDI 1
24:0 -> 28:0
#Midihub 2KMG9CN MIDI 2 -> NDLR IN 2
28:1 -> 32:1

Hi, amidiauto currently supports connections to just the first pair of input & output ports, the linked amidiminder utility may work better in your case.

Please create a dedicated thread for your setup, so we can find a proper solution for you.

Hi,
Amidiauto is a great tool ! …But not being able to set in & out ports is limiting.

Any news on an update ?

Nevermind, I just tried Amidiminder and it works really well for different ports !
Read it will be included in the next patchbox update. That’s great !

1 Like