Hi there, I am using your wonderful Patchbox OS to do MIDI routing.
I have some mididings scripts, but mainly just using the included “Patchage” app is great for my needs.
As my studio is growing, I hit the default ALSA cards_limit of 8 (I think).
In /var/log/syslog, this looks like this:
Nov 24 10:48:54 patchbox kernel: [96241.011034] usb 1-22.214.171.124.4: Product: Launch Control XL
Nov 24 10:48:54 patchbox kernel: [96241.011039] usb 1-126.96.36.199.4: Manufacturer: Focusrite A.E. Ltd
Nov 24 10:48:54 patchbox kernel: [96241.013601] snd-usb-audio 1-188.8.131.52.4:1.0: cannot find the slot for index -1 (range 0-7), error: -19
Nov 24 10:48:54 patchbox kernel: [96241.013624] usb 1-184.108.40.206.4: cannot create card instance 7
I see that my USB MIDI devices are all using snd-usb-audio. I could not find a cards_limit or similar driver options for that (modinfo -p snd-usb-audio) so I guess I would have to configure ALSA itself.
cat /sys/module/snd/parameters/cards_limit is 1 - which I do not understand as 7 USB MIDI devices (2 of which are also audio devices) have been loaded successfully.
According to this: https://www.raspberrypi.org/forums/viewtopic.php?t=177458 the number seems to be hardcoded at compile time. Patchbox OS has a custom ‘realtime’ kernel built for it, but we haven’t changed these options, we’ll include higher limits in the next release of Patchbox OS.
The kernel building scripts we used for Patchbox OS are here: https://github.com/BlokasLabs/rpi-kernel-rt, if you want to run it, you may want to edit build.sh to change rpi-4.19.y-rt to rpi-4.14.y-rt, as 4.19 RT kernel does not boot with older RPi versions that RPi4, as well as commenting out the last build_kernel line that’s meant to build the kernel for RPi4.
However, editing the config before building may be tricky if using the build.sh script, it would be easier to follow the steps manually.
Let us know if you manage to resolve the issue and how you did it.
there and continued further in the building manual (the make ..._defconfig step, then make ..., sudo make module-install, sudo cp...). Backing up the /boot/ directory before might be a good idea but I was too eager to try it out and just went ahead
What am I doing with the Raspberry / Patchbox OS?
I then happily connected 12 ALSA devices. My studio shall let me make music without any other computer. I connect a laptop to record the music from my 12 channel USB-mixer/interface just for recording.
The Raspberry is purely for MIDI routing.
I use JACK (quite uncommon) in a networked configuration. When it cannot reach the master laptop, it still is a jack MIDI router. I use the simple app Patchage to make connections and some mididings scripts for filtering/translating of MIDI events. When it (automatically) connects to the laptop’s JACK, I can route MIDI through the network to and from the laptop. The 2 devices are connected via LAN of course. ping is 0.5ms (min 0.3, max 0.8) and I am fine with the overall latency/jitter which is not noticable. The main latency in my setup is from the sound interface which runs at 48k/256/3.
I would like to have Pianoteq running on the Raspberry, but its just not powerful enough for sampling rates above 12k. I am thinking about an upgrade or a Pisound if that would run Pianoteq at 48k.
Pianoteq does run better via the I²S based audio cards, compared to USB ones, the default config for it in Patchbox OS image uses 48kHz rate for Jack audio, and 24kHz for the Engine rate. It might be able to run a little better on RPi4.
That snd_dummy test went fine for me, too.
I am sorry I only tried connecting all devices after updating. It worked without problems. I guess the problem I had was unrelated. amidi -l lists all devices now.