Hey, could you please describe the issue you are facing, it’s a pretty broad topic with many expectations one may have and different possible solutions.
Keep in mind that MIDI on Linux works differently than on other major OSes, unfortunately this is not in our control, we have to abide by Linux standards in order to be able to interoperate with existing MIDI software. That said, what we can do is we can try to improve the situation, and that’s what we did with the amidiauto service which is integrated by default in Patchbox OS image. Please see this documentation page: amidiauto - Patchbox OS Documentation
I look in /etc and there is no amidiauto.conf. Could this be the problem?
Then I launch PD (0.49.0 Plain vanilla, no externals) using the app menu in the Pi desktop. Under the PD preferences I am able to change the audio device to pisound, but when I try to set the midi device, there is only “none”. When I open the “test audio and midi” patch from the Media menu, the audio in and out work, but not midi. The red light next to the midi in jack on the pisound flashes, as well as a red led in the upper corner left of the word “pisound” when I play my midi device.
Please let me know if I can give you more information about the problem. Any help you can give would be greatly appreciated!
Hey, I discovered the problem. I hadn’t selected ALSA midi in PD. I tried it before I installed amidiauto, with no results, so I assumed it didn’t matter.
It would be really nice if there was somewhere in the main Pisound documentation that explains how to get this to work. I wasted many hours tracking down the problem.
Yes, ALSA MIDI backend is the best choice for MIDI on Linux. It all works based on virtual ports that must be interconnected together, according to your needs. This design has an additional step that users must be aware of, but provides for a lot of flexibility. Other OSes typically have audio/MIDI software list the MIDI devices, so you can pick the ones you want to use, which is straightforward.
As for making the connections, aconnect is the command line utility to use, and we’ve built amidiauto to automatically connect things for the most common use case of hardware interacting with software MIDI ports, and it also allows customization of that logic in the /etc/amidiauto.conf file for specific use cases.
Btw, once installed, amidiauto automatically registers a systemd service to run in the background, so these commands have to be used:
sudo systemctl status amidiauto - check whether it’s running.
sudo systemctl enable amidiauto - enable amidiauto to start automatically on boot.
sudo systemctl disable amidiauto - disable autostart on boot.
sudo systemctl start amidiauto - start amidiauto.
sudo systemctl stop amidiauto - stop amidiauto. If autostart is enabled, it will start again on next boot automatically.
We’d recommend using the Patchbox OS image for use with PD and other audio software - it already has the audio programs preconfigured to work smoothly, and if you update the patchbox config utility, it allows configuring a PD patch to be automatically started on system boot via the module submenu.
Also PD can be started via The Button and Pisound App, both of these ways of launching PD provide the right config to the PD process and takes care of MIDI connections.
Ah, now I have the modules section. I thought apt-get update, upgrade, dist-upgrade would bring me up to date.
I went to /usr/local/puredata-patches and made mkdir testpatch, touch testpatch/startup.pd
then ran the patchbox-config again but could not see my patch in the puredata module list.
How can I run my own patch?
One question related to amidiauto which I couldn’t find any details how to set up the config file so that the RTMidiOut client is connected with PureData Midi Input from startup? I need to manually configure this every time once the RPi has booted, and it’s a bit inconvenient if I’m not around. Thank you for your help with this!
Create a simple text file at /etc/amidiauto.conf, with the following contents:
[allow]
* <-> *
RtMidiOut -> Pure Data Midi-In
The * <-> * allow rule is the default behavior, in case the config file is not there or its parsing fails. It means to automatically connect all hardware and software ports together, which is usually a common expectation in most basic cases. As RtMidiOut and PD ports are both software, explicit rules have to be written to make amidiauto do the connection.
Many thanks for your great support as usual. I tried following your instructions, but after creating the file and entering
sudo systemctl restart amidiauto
nothing seems to have changed. I triple-checked the spelling to make sure no mistake was introduced on my end. Could you have a look at the attached images and let me know what might be the issue?
Also, you may check journalctl -u amidiauto to see the output of amidiauto - it should print out whether it’s using the rules file. Hit ‘End’ key to see the latest log lines.