Okay - got it!
source/include/sound/core.h
defines default maximum quantity of cards as 8 if CONFIG_SND_MAX_CARDS
is not defined in the kernel config.
/* number of supported soundcards */
#ifdef CONFIG_SND_DYNAMIC_MINORS
#define SNDRV_CARDS CONFIG_SND_MAX_CARDS
#else
#define SNDRV_CARDS 8 /* don't change - minor numbers */
#endif
This is the maximum quantity of sound cards that the Linux kernel will support. Soundcards include audio and MIDI. Devices that share audio and MIDI or have multiple ports may appear as a single card.
amidi -l
lists the MIDI cards whilst aplay -l
lists the audio cards. You will see that these cover all the cards from 0-7.
You have 4 USB MIDI devices using cards 3-7, f_midi using card 0 and 2 audio devices using cards 1-2. If you run aplay -l
you will see your audio cards. One will be sndrpihifiberry
and the other is likely to be Headphones
. The reason this stops Zynthian from starting up with all MIDI devices plugged in is because the 8 cards are being used but the MIDI and other audio interfaces hence the hifiberry is not available for jackd to use.
As described by @catherder we could recompile the kernel with a larger quantity of soundcards by passing CONFIG_SND_MAX_CARDS value to the kernel build. @jofemodo may consider this given that the prime use of this device is for audio it seems reasonable that we should allow many audio devices to be enabled.
In the short term there may be some options. The headphones device is enabled in /boot/config.txt
# Enable RBPi Onboard Audio (Headphones)
dtparam=audio=on
audio_pwm_mode=2
By commenting out these lines and rebooting the Headphones
device is removed which frees a card. It also removes the HDMI audio output which uses another card hence we end up with two extra cards which may suffice. This file will be overwritten if you subsequently change some configuration elements in webconf or some admin but may work for you as a temporary solution.
f_midi
is the OTG MIDI interface, that is an interface that is available if the Raspberry Pi is plugged into a USB host via its USB-C power connector. This is challenging due to power requirements for Zynthian but some people are experimenting with it. This can be disabled in /boot/config.txt
by commenting out the dwc2
overlay line.
[pi4]
# Enable OTG
dtoverlay=dwc2
This will give back another card but again remember the file can get overwritten.
We need a feature request to make both these options configurable from webconf to allow them to be disabled when not required.