Raspberry Pi Midi Host

Happy Sunday Electronauts!

I’ve got a Pi 3b+ that I’ve got set up with the latest version of Raspberry Pi OS - Buster (Lite) and trying to make it into a usb Midi Host. Having a bit of trouble. Everything looks fine and I’ve got to shake some of the rust off of my Linux skills.

sudo aconnect -l Lists the two devices I’m trying to connect (Korg Monologue / Skulpt Synth - have tried Digitakt to Skulpt as well)

aconnect 24:0 28:0
Manually connecting the devices says that they are connected. Which is validated by aconnect -l

sudo amidi -d -Should dump all the midi messages but it throws an error. Maybe alsa is not fully installed on Raspberry Pi OS? (Buster Lite)

Tried the Akai Fire to Skulpt but that proved unusable because it’s not a real controller, all functionality comes from the host and DAW

I used these two sites predominantly-

https://neuma.studio/rpi-midi-complete.html
&

The ruby script seems to be working perfectly but this guy says that there is a typo -

https://linuxmusicians.com/viewtopic.php?t=19736

So tomorrow, I’ll try using his ruby syntax and see if it changes anything. I’ll also try to reinstall alsa.

Anyone have a Pi working as USB MIDI host?

3 Likes

I’ve got a Pi set up with RetroPie for emulation…
But I’m interested in seeing this work out!

For viewing midi data coming from a given port I find aseqdump much more useful, because it prints the midi messages as human readable text.

aseqdump -l       ... lists available midi ports
aseqdump -p 24:0  ... dumps stream from port 24:0

I tried it for a while, cobbling together information from a few sites, but I was never 100% happy with it. I ended up shelling out for a RK006 which covered a lot of other things I wanted as well (MIDI to sync pulses, MIDI to dinsync, filtering etc). I’m just so terrible with Linux that even if I got it working properly, I always had the idea in the back of my mind that it could break at any time and I wouldn’t know how to fix it apart from completely re-doing the process over again.

Give Patchbox OS a go. It’s a custom version made specifically for audio and midi stuff, so comes preconfigured with most things setup, in particular amidiauto

They built a pretty simple way to configure device connections too, based on easy to define rules.

If you get stuck with the config in text mode, you can also load up the UI display version and use Patchage

This also has the added benefit that you can quickly get into PureData or some of the other stuff if you feel inclined!

6 Likes

This is the thread where they talk about defining the midi connections, like:

OPZ <-> Digitakt

Thanks for the tips everyone! I really want to get this down because I have some other ideas and things I’m helping with. Will report back when I get it going!

That’s what I had too then I decided to make it do midi. A lot of my gear has usb midi so why not. A 5$ micro SD card and you can swap out for games with the kiddos or for midi.

Plus the Oganelle, I believe, is a just Pi with a specialized case and controller interface to run Pure Data patches. Outside of work anything I work on is fun, and I’m trying to make even “the grind” more fun :slightly_smiling_face:

1 Like

Solved!

I think it was working all along but if you look closely you can see that the Monologue has two usb midi instances. I’m not sure why. Anyone know?

pi@raspberrypi:/lib/systemd/system $ aconnect -l
client 0: 'System' [type=kernel]
0 'Timer           '
1 'Announce        '
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 20: 'Skulpt Synth' [type=kernel,card=1]
0 'Skulpt Synth MIDI 1'
Connecting To: 24:0
Connected From: 24:0
client 24: 'monologue' [type=kernel,card=2]
0 'monologue MIDI 1'
Connecting To: 20:0
Connected From: 20:0
1 'monologue MIDI 2' 

Dumping the midi output was the key to figuring out this particular thing (Thanks for this tip Tom! @tnussb )

pi@raspberrypi:/lib/systemd/system $ aseqdump -p 24:0
Waiting for data. Press Ctrl+C to end.
Source  Event                  Ch  Data
... crickets * chirp * chirp

I picked the other port and then boom! It’s blasting midi everywhere.

pi@raspberrypi:/lib/systemd/system $ aseqdump -p 24:1 | more
Waiting for data. Press Ctrl+C to end.
Source  Event                  Ch  Data
24:1   Clock
24:1   Clock
24:1   Clock
24:1   Clock
24:1   Clock
24:1   Clock
24:1   Note on                15, note 42, velocity 127
24:1   Clock
24:1   Clock
24:1   Clock
24:1   Clock
24:1   Clock
24:1   Note off               15, note 39, velocity 64
24:1   Clock
24:1   Clock
24:1   Clock
24:1   Note on                15, note 39, velocity 127
24:1   Clock
24:1   Note off               15, note 42, velocity 64

So a manual connection between that second Monologue USB channel and the Skulpt and off we go!

pi@raspberrypi:/lib/systemd/system $ sudo aconnect 24:1 20:0

There is a difference in the Ruby code between the original and the one on Linux Musicians forum. I’ll let the Neuma team know of the update to the script. Its easy enough to understand what the script is doing but I’m not really a coder. To put the logic in the script to tell if :0 device or :1 device is the active one would probably take something clever. Unless its always the second channel. But manufacturers dont have any standards to adhere to there I don’t think. Could be wrong.

Anyways, just wanted to share this update with everyone and say thanks for the tips and the direction. I hope this helps others along the way. The Raspberry Pi’s are so cheap and ubiquitous that there are bound to be more cool little projects.

Oh one more thing, a strange coincidence. As I was getting parts and pieces together and working on this project, the power to the house went out for a few hours one night. The next day my main (and only) PC / DAW just stopped working. No post beeps or anything I think the built in video is just fried. But here I am on a Pi 4, posting this, being as productive as I’ve always been and I have a new way to connect my gear up. I’m truly DAWless as it turns out. Just thought it was funny :smile:

2 Likes

That’s the MIDI IN and MIDI OUT port (MIDI ports are unidirectional).

Pure Data running here provides, for example, the following couple (obviously much better named):

client 128: 'Pure Data' [type=user]
    0 'Pure Data Midi-In 1'
    1 'Pure Data Midi-Out 1'

To distinguish between in and out ports you can use:

aconnect -i ... list only sender ports
aconnect -o ... list only receiver ports
1 Like

The more you know :rainbow::star2: :smile:

The Skulpt has midi in and out port via 5 pin DIN / maybe just not USB MIDI out then?

pi@raspberrypi:~ $ sudo amidi -l
Dir Device Name
IO hw:1,0,0 monologue MIDI 1
IO hw:1,0,1 monologue MIDI 2
IO hw:2,0,0 Skulpt Synth MIDI 1

but then

pi@raspberrypi:~ $ aconnect -i
client 0: ‘System’ [type=kernel]
0 'Timer ’
1 'Announce ’
client 14: ‘Midi Through’ [type=kernel]
0 ‘Midi Through Port-0’
client 20: ‘monologue’ [type=kernel,card=1]
0 ‘monologue MIDI 1’
1 ‘monologue MIDI 2’
client 24: ‘Skulpt Synth’ [type=kernel,card=2]
0 ‘Skulpt Synth MIDI 1’

pi@raspberrypi:~ $ aconnect -o
client 14: ‘Midi Through’ [type=kernel]
0 ‘Midi Through Port-0’
client 20: ‘monologue’ [type=kernel,card=1]
0 ‘monologue MIDI 1’
1 ‘monologue MIDI 2’
client 24: ‘Skulpt Synth’ [type=kernel,card=2]
0 ‘Skulpt Synth MIDI 1’

No matter though, the Skulpt was to be used as a module to receive midi notes not send them. So all is good as far as my use case goes! :smile:

Blockquote That’s the MIDI IN and MIDI OUT port (MIDI ports are unidirectional).

I don’t actually think this is the case. I think devices often have additional ports because they need more bandwidth, for instance does the monologue have audio over USB, and therefore the second port is for that?

I know my launchpad has 3 virtual USB ports, but only one is used for midi both in and out). Sometimes an additional USB port also adds another full set of 16 USB channels, so 2 ports gives you 32 channels, through the same physical port.

Please correct me if I’m wrong though!

I was definitely wrong. USB MIDI endpoints can be used for input and output at the same time.

I don’t think audio ports would be listed with aconnect.

No, the Korg Monologue unfortunately does not do audio over USB. It does have a driver that Korg offers that supports it as well as several dozen other products. It could be for their librarian software, or something like that.

1 Like

Well, I think we’ve all learned something here today. Haha!

2 Likes