Raspberry Pi as hub for USB midi devices - advice?


#1

Hi y'all! I just got my Axoloti a few days ago and I'm super excited to play around with it. I've managed to solder headers onto the board and get one 10k pot read by the patcher, which for a dude who barely ever soldered anything before is pretty good.

I figured out that to build a panel with lots of pots (like 32) I'm going to probably need to learn how to work with a multiplexer, which is cool, and my ultimate goal is to build a synth that can also function as a midi controller. But I'm a newbie to hardware (I'm a web developer mostly) and for now, I wanna use my existing midi controllers like the Korg NanoKontrol and an ancient Oxygen49 to control my patches live.

I don't want to use my MacBook though - I'd prefer to have an all-in-one box that I can just hook my controllers up to and go. Obviously I'm limited with the Axoloti to a single USB device, but it occurs to me that I have several raspberry pis (one original Model B, two 2s and a 3 coming as a birthday gift) and that it would be easy to use one as a hub to plug multiple USB devices into to send their output over microusb to the Axoloti. I also figure I could also write code that would let the pi drive a 2x8 lcd screen for basic feedback on what parameters and such I'm controlling (either based on the midi cc coming in or via feedback over the USB from the Axoloti).

What I'm wondering is if any of you can recommend the best way to configure midi on the pi. I can write Node code to send and receive midi, at least on Mac, but I've never tried anything with midi on any Linux devices (though I know Linux fairly well from a web developer point of view). So I'm not even sure if my class compliant devices should just plug and play out of the gate if I'm running command line Raspbian or if I need to install some manager or something via repo.

I know there's resources out there for all of this but I figured I'd ask here first. I know that the patcher apparently runs badly on the pi, but I assume midi shouldn't be weird, right? I'd like to write and test the code on my mac and then test it on the pi, but I have no idea if midi works the same way on Linux as Mac (i.e. you pick a device number or numbers to listen to and go from there).

Any recommendations or advice would be appreciated! Thanks!


#2

My friend @logsol did the same using this little beast: https://getchip.com/pages/chip
It seems to work perfectly well with a usb hub and several usb controllers.

I think if you ask him he would be happy to share the code with you.


Usb hub support in new firmware (not released)
#3

yeah, axoloti works fine connected to rPI, and appears as a alsa midi device.
(ive been doing this, in fact with multiple axolotis connected , and also a few controllers)

you could write it in node.js, or anything thats supports midi e.g. Pd.
(I use C++, but thats just because its my preferred tool :))

the currently limitation is its tricky (not impossible) to get parameters information back from axoloti,
this is ok if you drive it all from the PI, but if you want two way info (e.g. because the patch changes), this takes more work.
this will hopefully improve in the next version of the Axoloti firmware, but be clear, it will still require programming on your part... (though once its done, Im considering writing an OSC bridge, when I get time)


Midi between boards
#4

Yes I did exactly that in python for my C.H.I.P, which is a similar platform to Raspi and I am super happy with the result. I've been meaning to publish this in the community but since I've been mentioned, here you go.
Feel free to use the code, I put the code on github https://gist.github.com/logsol/f9532b5799c5c12c8e15f99b077a7a55

It is very fresh and not fully tested yet but I already did two jams with it for a couple of hours and it was nicely fast and stable when the Axoloti was connected directly to the chip via usb.

The controllers should send from midi channel 1 and then they are being mapped to a new channel based on the channelMap in the script. This way you can know what controller your data is coming from in Axoloti and you can send midi data back via the same channel. It is also fully plug&play so you you should be able to start it on boot and plug and play axoloti and controllers as you go.

Let me know if it works for you on your Raspberry


#5

Thanks, y'all! I don't think I need actual data back from the Axoloti so long as I'm sending the midi from the pi - I'll make the lcd report the midi data itself - but it would be cool to have two way usb interaction with the Axoloti internals.

I'm excited by this! I just wish the patcher worked properly on the pi. That would be an amazing all-in-one workstation!


#6

Damn. Chips on back order.......

I was sleeping


#7

Hi there . Im happy to had spent some time with the new update and with mido library in Python . Following on @logsol idea and after a lot of brainstorming and dreaming of it with @Blindsmyth, I gave it a go and it works really well I must say .

Let me know your thoughts . Its no big deal yet , but the potential is clear.

Im driving now my poliphonic patch with my microbrute and using Launchcontrol XL simultaneously on the same usb in the axo like a charm .

Will keep reporting :wink:


#8

Hi Carlo, nice to see this idea being developed further and thanks for the mentions! What’s the reason you moved away from rtmidi to mido? And are there any new features in your version? :slight_smile:


Multiple Midi Controllers Working ! + Ableton Link and other dreams
#9

Hey @logsol I just started out fiddling with your gist and then found mido by chance searching for midi over TCP and Multiport input. No real reason behind , i just liked how simple the scripting is .

For now just testing out how to have the keyboard notes+ pitchbend from the microbrute and an extra controller to modulate the axoloti patch. Im having some trouble at the moment with polyphony , I will get back to it and report to you guys .


#10

Hey hey ,
continuing with this. I have now all the notes from my analog synth keyboard to axoloti , and the LaunchControl XL sending CC working flawlessly.

Im making some more tests , add some argument parser so you can use the script with your own controllers without editing it .

Probably now that I have the pi on the game I will experiment with ableton link too and some synthesis in the headless pi .


#11

this is very nice!
It makes me wonder: if I had several controllers and several axolotis and I use this to manage midi communication via usb between all of them. The raspberry pi is like the center hub for everything. Would it be possible that the pi also manages communication between computer and the axoloti? Especially managing the connection with the patcher?


#12

All you can think of in those terms is possible between the 4 onboard usb ports. Needless to say that you can also attach a MIDI DIN breakout board to the pi and have an additional IN / OUT DIN for anything else.
There are many ways to control a computer from a pi, it doesn't require midi necessarly if it's not too time sensitive but you could I guess.


#13

This looks neat too. And you can change the midi routing "scenes" on the fly


#14

mididings!
that's what i used on my Linux laptop back in the days.

but i wonder is it still maintained at all, since it's written in python2, an last commit on github was in 2015…


#15

I might try it soon and report back if I get trouble with my current project. It is old indeed but based on pretty solid libraries so I dont think that could be a problem anytime soon before MIDI 2.0 :slight_smile:

I've just installed the script and it works , at last nothing its broken, will report again when I test it out with some controllers.

btw Middings is such a wonderful tool . I will replace my system with this if its stable ,since my current setup uses python and mido , but mididings seems to run in lower level (C++) and uses python as interface

MIDIDINGS start


#16

Im following this method described here now , to get UART midi as a midi device into the equation as well


#17

thanks for the idea of using Pi for USB MIDI hub job.

installed Alpine Linux, built RT kernel, wrote udev rules for Axo & controllers that invoke aconnect.
just works.


#18

Hey Never heard of this distro , will look at it. AT the moment I use raspbian lite and as you said
aconnect -i after

ttymidi -s /dev/ttyAMA0 -b 38400 &

just works here too ! Just waiting for a pack of jumper wires to test it .

This will be super cool since I can use 4 onboard usb's + 1 tty serial midi to axoloti smoooooth

And even if old , i think I will be using mididings instead of my old approach

I just felt in love with mididings after reading the docs , the scenes system is just too good and all the other commands , sweeeet

putting together a small gist to remember all the steps pi_MIDI_brain

another useful gist to setup a "minimal" general purpose list of useful things for getting started into headless realms with the pi


Raspberry && Axoloti ❤️️ Thread
#19

Alpine is ultra-small & lightweight.
singnificantly lighter than mainstream distros (and perfectly runs from RAM).

Mididings are nice, but don't have „proper“ NRPN support — which is major PITA if you have to talk to e.g. Novation gear.
of course, workaround can be done treating NRPN message as a sequence of four CC — but that's pretty tricky.


#20

well cool . Is working smooth . I will open a new thread soon . Just got UART midi in & out working flawleslly ,
moded the extra-midi-io script to receive midi clock too