[SOLVED] MIDI connection on Raspberry PI - All device connected

Hi Jean,

thanks for work Open Stage Control, it's nice piece of software.

I find a little bug on this setup:
Raspbery PI 4B
Patchbox OS from BlokasLab
Two DIN->USB cables:

  1. ESI MIDIMATE eX - both line incoming midi singnal
  2. unbranded USB MIDI cable - one line in, second line out

USB sound card Behringer UMC-1820
Open Stage Control runing over node

before starting the Open Stage Control I have this midi connections:

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 20: 'ESI MIDIMATE eX' [type=kernel,card=1]
    0 'ESI MIDIMATE eX MIDI 1'
	Connecting To: 129:0[real:0]
	Connected From: 129:0
    1 'ESI MIDIMATE eX MIDI 2'
	Connecting To: 129:0[real:0]
	Connected From: 129:0
client 24: 'USB MIDI cable' [type=kernel,card=2]
    0 'USB MIDI cable MIDI 1'
	Connecting To: 129:0[real:0]
	Connected From: 129:0
    1 'USB MIDI cable MIDI 2'
	Connecting To: 129:0[real:0]
	Connected From: 129:0
client 28: 'UMC1820' [type=kernel,card=3]
    0 'UMC1820 MIDI 1  '
	Connecting To: 129:0[real:0]
	Connected From: 129:0

List of midi from Open Stage Control is here:

node ~/ProductionMusic/open-stage-control-1.17.0-node -s 192.XXX.XX.102:1370 -m list -d
(INFO) Headless mode (--no-gui) enabled automatically (running with node)
(INFO) Server started, app available at 
    http://127.0.0.1:8080
    http://192.XXX.XX.104:8080
    http://192.XXX.XX.101:8080
(INFO, MIDI) Inputs
    -1: Void (bypass)
    0: Midi Through:Midi Through Port-0 14:0
    1: ESI MIDIMATE eX:ESI MIDIMATE eX MIDI 1 20:0
    2: ESI MIDIMATE eX:ESI MIDIMATE eX MIDI 2 20:1
    3: USB MIDI cable:USB MIDI cable MIDI 1 24:0
    4: USB MIDI cable:USB MIDI cable MIDI 2 24:1
    5: UMC1820:UMC1820 MIDI 1 28:0
(INFO, MIDI) Outputs
    -1: Void (bypass)
    0: Midi Through:Midi Through Port-0 14:0
    1: ESI MIDIMATE eX:ESI MIDIMATE eX MIDI 1 20:0
    2: ESI MIDIMATE eX:ESI MIDIMATE eX MIDI 2 20:1
    3: USB MIDI cable:USB MIDI cable MIDI 1 24:0
    4: USB MIDI cable:USB MIDI cable MIDI 2 24:1
    5: UMC1820:UMC1820 MIDI 1 28:0

I want midi signals to be sent via USB cable, so I start sever by this command:

node ~/ProductionMusic/open-stage-control-1.17.0-node -s 192.XXX.XXX.102:1370 -m PC:3,4 -d
(INFO) Headless mode (--no-gui) enabled automatically (running with node)
(INFO) Server started, app available at 
    http://127.0.0.1:8080
    http://192.XXX.XXX.104:8080
    http://192.XXX.XXX.101:8080
(DEBUG, MIDI) device "PC" created
(DEBUG, MIDI) device "PC" connected to input port 3 (USB MIDI cable:USB MIDI cable MIDI 1 24:0)
(DEBUG, MIDI) device "PC" connected to output port 4 (USB MIDI cable:USB MIDI cable MIDI 2 24:1)

And now the problem, other devices are suddenly connected to the OSC server, see the connection list

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 20: 'ESI MIDIMATE eX' [type=kernel,card=1]
    0 'ESI MIDIMATE eX MIDI 1'
	Connecting To: 129:0[real:0], 132:0
	Connected From: 129:0, 133:0
    1 'ESI MIDIMATE eX MIDI 2'
	Connecting To: 129:0[real:0]
	Connected From: 129:0
client 24: 'USB MIDI cable' [type=kernel,card=2]
    0 'USB MIDI cable MIDI 1'
	Connecting To: 129:0[real:0], 132:0
	Connected From: 129:0, 133:0
    1 'USB MIDI cable MIDI 2'
	Connecting To: 129:0[real:0]
	Connected From: 129:0, 133:0[real:0]
client 28: 'UMC1820' [type=kernel,card=3]
    0 'UMC1820 MIDI 1  '
	Connecting To: 129:0[real:0], 132:0
	Connected From: 129:0, 133:0
client 132: 'PC' [type=user,pid=1252]
    0 'midi_in         '
	Connected From: 24:0, 20:0, 28:0, 129:0
client 133: 'PC' [type=user,pid=1252]
    0 'midi_out        '
	Connecting To: 24:1[real:0], 20:0, 24:0, 28:0, 129:0[real:0]

It probably shouldn't behave like this. It is not a problem for me to write a script that disconnects inappropriate connections using aconnect -l, but I perceive this behavior as an error.

I'm not sure to understand what's the problem is exactly and which connections are undesired here, but in any case under linux I strongly recommend using virtual ports ( -m PC:virtual instead of -m PC:3,4) and connecting them using aconnect or qjackctl.

Hi, thanks for reply.

I assumed connection only between designated devices. In case -m PC:3,4 only this conection:

client 132: 'PC' [type=user,pid=1252]
   0 'midi_in         '
   Connected From: 24:0, 129:0
client 133: 'PC' [type=user,pid=1252]
   0 'midi_out        '
   Connecting To: 24:1[real:0], 129:0[real:0]

I tried -m PC:virtual, the result is same as above in first contribution.
PC client is automaticaly connected to all physical midi clients.
Here is details (I remove the ESI cable from Raspberry, so is missing)

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 28: 'USB MIDI cable' [type=kernel,card=3]
    0 'USB MIDI cable MIDI 1'
	Connecting To: 129:0[real:0], 132:0
	Connected From: 129:0, 133:0
    1 'USB MIDI cable MIDI 2'
	Connecting To: 129:0[real:0]
	Connected From: 129:0
client 32: 'UMC1820' [type=kernel,card=4]
    0 'UMC1820 MIDI 1  '
	Connecting To: 129:0[real:0], 132:0
	Connected From: 129:0, 133:0
client 132: 'PC' [type=user,pid=3257]
    0 'midi_in         '
	Connected From: 28:0, 32:0, 129:0
client 133: 'PC' [type=user,pid=3257]
    0 'midi_out        '
	Connecting To: 28:0, 32:0, 129:0[real:0]

So Open Stage Control make virtual ports "PC" on 132 and 133 position a automaticaly they connects to 28:0 USB midi cable and 32:0 Behringer UMC1820.

When I use aconnect -d the unnecessary conection will be canceled. It's not problem, little scripts will make correct settings. I describe it as behavior I did not expect.

Have a nice day.

Open Stage Control doesn't attempt to make any connection when using virtual ports so that's very weird, I'll give it a try anyway when I get my hands on a physical MIDI device.

Hi @jean-emmanuel,
stop investigation in this point.

The real culprit is amidiauto, which is working as a background process on PatchBox OS.
The solution is to turn it off by

sudo systemctl stop amidiauto
sudo systemctl disable amidiauto

Or replace it using the Amidiminder utility. GitHub - mzero/amidiminder: ALSA utility to keep your MIDI devices connected

@jean-emmanuel thanks for your work on OSC.

Great news, have fun with osc :slight_smile: