MODEP not detecting `rtpmidid` as a MIDI device

Hi!

rtpmidid is a daemon which allows for MIDI messages to be read/written over the network. It would be awesome to be able to successfully run this on a MODEP device and enable an additional level of connectivity- network-based MIDI I/O! Imagine being able to interact with a VST over the network!

I’m able to build it like so:

sudo apt-get -y install cmake libfmt-dev libasound2-dev libavahi-client-dev
git clone https://github.com/davidmoreno/rtpmidid.git
cd rtpmidid/

# ensures only two build processes run concurrently..
# you need this so that `make build` doesn't completely kill the raspi
sed -i 's/make -j/make -j 2/' Makefile

make build

Running it is totally successful:

./build/src/rtpmidid
[2021-01-10T18:07:33Z] [main.cpp:58] Real Time Protocol Music Instrument Digital Interface Daemon - 20.04.5
[2021-01-10T18:07:33Z] [main.cpp:59] (C) 2019 David Moreno Montero <dmoreno@coralbits.com>
[2021-01-10T18:07:33Z] [mdns_rtpmidi.cpp:89] watch_new 5 1
[2021-01-10T18:07:33Z] [rtpserver.cpp:65] Try listen at :::5004
[2021-01-10T18:07:33Z] [rtpserver.cpp:91] Control port at :::5004
[2021-01-10T18:07:33Z] [rtpserver.cpp:131] Listening RTP MIDI connections at 0.0.0.0:5004, with name: 'patchbox'
[2021-01-10T18:07:33Z] [control_socket.cpp:72] Error Listening to socket at /var/run/rtpmidid/control.sock: No such file or directory
[2021-01-10T18:07:33Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'koto' of type '_apple-midi._udp' in domain 'local'
[2021-01-10T18:07:33Z] [mdns_rtpmidi.cpp:306] (Browser) CACHE_EXHAUSTED
[2021-01-10T18:07:33Z] [aseq.cpp:123] New ALSA connection from port RtMidiOut Client-RtMidiIn Client:TouchOSC Bridge 131:0 (132:0)
[2021-01-10T18:07:33Z] [rtpmidid.cpp:202] Connected to ALSA port 132:0. Create network server for this alsa data.
[2021-01-10T18:07:33Z] [rtpserver.cpp:65] Try listen at :::0
[2021-01-10T18:07:33Z] [rtpserver.cpp:91] Control port at :::59846
[2021-01-10T18:07:33Z] [rtpserver.cpp:131] Listening RTP MIDI connections at 0.0.0.0:59846, with name: 'patchbox/RtMidiOut Client-RtMidiIn Client:TouchOSC Bridge 131:0'
[2021-01-10T18:07:33Z] [aseq.cpp:123] New ALSA connection from port jack_midi-port (130:0)
[2021-01-10T18:07:33Z] [rtpmidid.cpp:202] Connected to ALSA port 130:0. Create network server for this alsa data.
[2021-01-10T18:07:33Z] [rtpserver.cpp:65] Try listen at :::0
[2021-01-10T18:07:33Z] [rtpserver.cpp:91] Control port at :::44983
[2021-01-10T18:07:33Z] [rtpserver.cpp:131] Listening RTP MIDI connections at 0.0.0.0:44983, with name: 'patchbox/jack_midi-port'
[2021-01-10T18:07:33Z] [aseq.cpp:123] New ALSA connection from port jack_midi-port (130:0)
[2021-01-10T18:07:33Z] [rtpmidid.cpp:202] Connected to ALSA port 130:0. Create network server for this alsa data.
[2021-01-10T18:07:33Z] [rtpmidid.cpp:162] Already a rtpserver for this ALSA name at 130:0 / patchbox/jack_midi-port. RTPMidi port: 44983
[2021-01-10T18:07:33Z] [mdns_rtpmidi.cpp:236] Discovered service 'koto' of type '_apple-midi._udp' in domain 'local'
[2021-01-10T18:07:33Z] [rtpmidid.cpp:244] New alsa port: 1, connects to host: 192.168.10.142, port: 5004, name: koto
[2021-01-10T18:07:33Z] [aseq.cpp:123] New ALSA connection from port jack_midi-port (130:0)
[2021-01-10T18:07:33Z] [rtpmidid.cpp:249] Callback on subscribe at rtpmidid: jack_midi-port
[2021-01-10T18:07:33Z] [rtpclient.cpp:77] Try connect to service at 192.168.10.142:5004
[2021-01-10T18:07:33Z] [rtpclient.cpp:99] Try connect to resolved name: 192.168.10.142:5004
[2021-01-10T18:07:33Z] [rtpclient.cpp:118] Connected to resolved name: 192.168.10.142:5004
[2021-01-10T18:07:33Z] [rtpclient.cpp:127] Control port, local: 33332, remote at 192.168.10.142:5004
[2021-01-10T18:07:33Z] [rtpclient.cpp:156] MIDI PORT at port 33332
[2021-01-10T18:07:33Z] [rtpclient.cpp:182] Connecting control port 33332 to 192.168.10.142:5004
[2021-01-10T18:07:33Z] [aseq.cpp:123] New ALSA connection from port jack_midi-port (130:0)
[2021-01-10T18:07:33Z] [rtpmidid.cpp:249] Callback on subscribe at rtpmidid: jack_midi-port
[2021-01-10T18:07:33Z] [rtpmidid.cpp:290] Already connecting.
[2021-01-10T18:07:33Z] [rtppeer.cpp:154] Got confirmation from koto, initiator_id: 1638376310 (true) ssrc: 136107313, name: koto, port: Control
[2021-01-10T18:07:33Z] [rtpclient.cpp:189] Connecting midi port 33333 to 192.168.10.142:5005
[2021-01-10T18:07:33Z] [rtppeer.cpp:154] Got confirmation from koto, initiator_id: 1638376310 (true) ssrc: 136107313, name: koto, port: MIDI
[2021-01-10T18:07:33Z] [rtppeer.cpp:346] Send CK0 to koto
...

qjackctl is totally aware of it as a MIDI device as well.

However, even if I restart modep-mod-ui and modep-mod-host, the MIDI device that rtpmidid creates is not listed as available in the web UI.

What do I need to do in order to it to show up so that I can interact with it with MODEP patches?

Thanks for the help!

The ALSA MIDI ports have a ‘type’ - it mostly says whether the port is a hardware one, or a software one. MOD software looks only for ‘hardware’ MIDI ports, so you have to make it appear as one. One way to do that is to modify the source code to specify the hardware type where the port is being created. (example port creation call, note the SND_SEQ_PORT_TYPE_HARDWARE argument)

Another option is to work around it by creating a special ‘thru’ port. We had to do this for example to get touchosc2midi port to show up - the RtMidi library it’s using internally does not even allow users to specify the port type, so changing the source code was too involved.

This can be done by using our amidithru client, already available on the system, start it by running:

amidithru rtp

‘rtp’ is the display name for the port how it will be shown, you may use whatever you like. :slight_smile:

Then list all ALSA MIDI virtual ports:

aconnect -l

Use aconnect to connect the real RTP MIDI port(s) to the rtp amidithru port, in both directions. Then this port should be usable in MODEP.

If there’s some issue, please show us the output of aconnect -lio after having started the amdithru process.

1 Like

@Giedrius YEP the amidithru and aconnect instructions totally worked! I’ll investigate the port creation call in rtpmidid to make the solution simpler and then document the results somewhere so that others can replicate.

I was able to successfully direct midi messages to a Windows machine running Arturia Analog Lab 4.

(Of course for those reading, it will be best to do something like this over a wired ethernet connection and not WiFI- otherwise you can introduce latency.)

Thanks for the help!

3 Likes