Script for launching PD patch with MIDI without aconnect

That works. Thanks.

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!

You’ll have to add a rule for that in /etc/amidiauto.conf. What is the output of aconnect -l when all the software is running?

Many thanks for your kind offer to help! This is the log I receive after typing aconnect -l

patch@patchbox:~ $ aconnect -l
client 0: ‘System’ [type=kernel]
0 'Timer ’
1 'Announce ’
Connecting To: 128:0, 129:0
client 14: ‘Midi Through’ [type=kernel]
0 ‘Midi Through Port-0’
Connecting To: 129:0[real:0]
Connected From: 129:0
client 16: ‘LilyPad USB’ [type=kernel,card=0]
0 ‘LilyPad USB MIDI 1’
Connecting To: 129:0[real:0], 131:0, 130:0
Connected From: 129:0, 131:1, 133:0
client 20: ‘LilyPad USB Plus’ [type=kernel,card=1]
0 ‘LilyPad USB Plus MIDI 1’
Connecting To: 129:0[real:0], 131:0, 130:0
Connected From: 129:0, 131:1, 133:0
client 24: ‘LilyPad USB Plus’ [type=kernel,card=2]
0 ‘LilyPad USB Plus MIDI 1’
Connecting To: 129:0[real:0], 131:0, 130:0
Connected From: 129:0, 131:1, 133:0
client 28: ‘Arduino Leonardo’ [type=kernel,card=3]
0 ‘Arduino Leonardo MIDI 1’
Connecting To: 129:0[real:0], 131:0, 130:0
Connected From: 129:0, 131:1, 133:0
client 40: ‘pisound’ [type=kernel,card=6]
0 ‘pisound MIDI PS-1M0GXQD’
Connecting To: 129:0[real:0], 131:0, 130:0
Connected From: 129:0, 131:1, 133:0
client 130: ‘pisound-ctl’ [type=user,pid=735]
0 'pisound-ctl ’
Connecting To: 129:0[real:0], 131:0
Connected From: 129:0, 16:0, 20:0, 24:0, 28:0, 40:0, 133:0
client 131: ‘Pure Data’ [type=user,pid=953]
0 ‘Pure Data Midi-In 1’
Connected From: 16:0, 20:0, 24:0, 28:0, 40:0, 130:0, 129:0
1 ‘Pure Data Midi-Out 1’
Connecting To: 16:0, 20:0, 24:0, 28:0, 40:0, 129:0[real:0]
client 132: ‘RtMidiIn Client’ [type=user,pid=1358]
0 'TouchOSC Bridge ’
Connected From: 133:0, 129:0
client 133: ‘RtMidiOut Client’ [type=user,pid=1358]
0 ‘RtMidiIn Client:TouchOSC Bridge 132:0’

Try adding this line to /etc/amidiauto.conf, under [allow] section:

RtMidiOut -> Pure Data Midi-In

Then do:

sudo systemctl restart amidiauto

This adds a rule to amidiauto to always make this software connection, when these software MIDI ports appear.

Many thanks for the suggestion! What should I do if /etc/amidiauto doesn’t exist?

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.

1 Like

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?


Try this amidiauto.conf instead:

[allow]
* <-> *
RtMidiOut -> Pure Data

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.

Many thanks for the suggestion, this did the trick!

So it has to be

RtMidiOut -> Pure Data

instead of

RtMidiOut -> Pure Data Midi-In

1 Like

does this work with amidiminder as well?

Reading the description on Github makes me believe so:

  1. It also Watches any connections you make with aconnect or that your software makes, and remembers them too.
1 Like

further to this topic: I want to autoconnect the software ports Midi through to Pure Data In. I tried this in /etc/amidiauto.conf

[allow]
* <-> *
Midi Through -> Pure Data

But no result.

What’s the output of aconnect -lio when PD is running?

patch@Pisound:~$ aconnect -lio
client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
	Connecting To: 128:0, 129:0
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
	Connecting To: 129:0[real:0]
	Connected From: 129:0, 134:0[real:0]
client 16: 'pisound' [type=kernel,card=0]
    0 'pisound MIDI PS-0D32Z7E'
	Connecting To: 129:0[real:0], 132:0, 133:0, 135:0
	Connected From: 129:0, 131:0, 132:1, 133:1, 134:0, 135:0
client 130: 'RtMidiIn Client' [type=user,pid=669]
    0 'TouchOSC Bridge '
	Connected From: 131:0, 129:0, 132:1, 133:1, 134:0, 135:0
client 131: 'RtMidiOut Client' [type=user,pid=669]
    0 'RtMidiIn Client:TouchOSC Bridge 130:0'
	Connecting To: 16:0, 130:0, 129:0[real:0], 132:0, 133:0
client 132: 'Pure Data' [type=user,pid=888]
    0 'Pure Data Midi-In 1'
	Connected From: 131:0, 16:0, 129:0, 134:0
    1 'Pure Data Midi-Out 1'
	Connecting To: 16:0, 130:0, 129:0[real:0]
client 133: 'Pure Data' [type=user,pid=1315]
    0 'Pure Data Midi-In 1'
	Connected From: 131:0, 16:0, 129:0, 134:0
    1 'Pure Data Midi-Out 1'
	Connecting To: 16:0, 130:0, 129:0[real:0]
client 134: 'RtMidiOut Client' [type=user,pid=1325]
    0 'RtMidi output   '
	Connecting To: 14:0[real:0], 132:0, 133:0, 16:0, 130:0, 129:0[real:0]
client 135: 'pisound-ctl' [type=user,pid=1349]
    0 'pisound-ctl     '
	Connecting To: 16:0, 130:0, 135:0, 129:0[real:0]
	Connected From: 16:0, 135:0, 129:0

However, thinking more about it I’ve no need to use Midi Through. I just make the connection into PD from RtMidiOut as per your suggestion earlier in this post…and it works. Silly me.

1 Like