spDuchamp For this guitar project, I have a MIDI keyboard plugged into the Bela Gem Multi host USB port, and then the MIDI from the Bela is sent over USB to the computer. If I boot up the Bela with the MIDI keyboard plugged into the host port of the guitar, everything is fine. I get this... Num Name In Out Pd channels [ 0] hw:1,0,0 x x (1-16) [ 1] hw:0,0,0 x x (17-32) But if I boot it up without the MIDI keyboard attached things don't work. I get this... The following MIDI devices are enabled: Num Name In Out Pd channels [ 0] hw:0,0,0 x x (1-16) Is there something I should be adding to my Pd patch to keep the MIDI stuff assigned properly to that the MIDI keyboard can be plugged in after the Bela guitar hard booted up? I can just say the keyboard needs to be connected before booting, but I'd rather just make it fool proof.
giuliomoro Is your image up to date? I believe I fixed this at some point early on, so that the USB interface to the host takes up the hw:0,0,0 all the time, and only the remaining slots are usable by USB devices connected to it ... can you go through the update procedure in the IDE, reboot and see if the problem persists?
spDuchamp I'm pretty sure I'm up-to-date. I have run the Check for Updates and it did it's thing. (Version details below) I've testing things again, and yes, I'm getting the same behaviour as described above. And to be clear, when things are working, port 0 (ch1-16) are the MIDI controlled plugged into the USB host, and port 1 (ch17-32) are to the computer over the USB cable. My patch has a [loadbang] -> [hw 0 0 0( -> [set bela_setMidi] Version details Image: v1.0.0, 5 February 2026 Core code: Git desc: 'fb362a5-dirty' Package Version bela-all 0.1.49 bela-core 1-36-dev-pb2-73efc747 bela-csound 7.0.beta9-872237d bela-dtbs 0.1.8 bela-ide 1-0-base-337-g032bdbc2-032bdbc2 bela-supercollider 3.15.0-dev-bela-3.14.1 bela-usb-gadgets 1.20260204.0-0bookworm+20260204 bela-utils 0.1.14 libpd-bela-dev 0.14.1-91-g1a07c4a-dirty-Pd-Bela-0.56-2-b1-1
giuliomoro what do you get if you run this command in the console at the bottom of the IDE? cat /etc/modprobe.d/snd_usb_midi.conf ?
spDuchamp # reserve index=0 for the USB gadget's MIDI device options snd-usb-audio index=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
giuliomoro when it boots up like this: Num Name In Out Pd channels [ 0] hw:1,0,0 x x (1-16) [ 1] hw:0,0,0 x x (17-32) What is hw:1,0,0? Is it the keyboard? And are you using the MIDI interface to the host computer?
spDuchamp Yup. hw:1,0,0 (port 0) is the Korg nanoKEYS2 plugged into the Bela Gem Multi USB-A port, and the hw:0,0,0 (port 1) is the MIDI interface to the host computer.
giuliomoro Are you using the MIDI interface to the host computer? i.e.: are you sending MIDI from Bela to the computer, or from the computer to Bela?
spDuchamp Right now, it is the Bela sending MIDI to the computer, but later we may be sending control and program change messages back to the Bela. The MIDI keyboard attached to the Bela USB port is to trigger the chord changes.
giuliomoro Using the existing API and backend, what can be done is: [loadbang] | [auto( | [send bela_setMidi] this will allow automatic discovery of devices as they are connected. The issue is that it won't guarantee the specific order in which they are address by the code. For instance, if hw:1,0,0 is immediately present it will go to slot [0], but if it is connected later it will go to slot [1]. As long as you have a unique type of messages coming from each midi interface and you don't mind sending the same message to all interfaces, this should be good enough, though a bit cumbersome. If you need to univocally identify the source port and only want to send each message to a single port, then I need to do some work on the C++ side.
spDuchamp Hmm. I really want to keep this project all in Pd. Ideally ports wouldn't shift around. I might just have to say that they keyboard needs to be plugged in first, and that's that. Thanks for help on this.