My system requires more than 32 USB sound cards

I am working on a multiseat training project where we need to connect 36 keyboards and 36 USB sound cards to one computer. We are running Ubuntu Linux 12.04 with the kernel 3.6.3-030603.

So far, we have managed to get data from 36 keyboards and recognize 36 sound cards without getting a kernel panic (what happened before the kernel update). We know that 36 sound cards were recognized because $ lsusb | grep "Audio" -c $ lsusb | grep "Audio" -c prints 36 .

However, $ aplay -l contains 32 playback devices in total (including the "internal" sound card). In addition, $ alsamixer -c 32 says "invalid card index: 32" (only works from 0 to 31, 32 in total).

So my question is: how can I access other sound cards if they are not even listed with these commands? I am writing a python application and there are some libraries to choose from, but I am afraid that because of this they will also be limited to 32 devices. Any guidance would be helpful.

Thanks.

+6
source share
2 answers

The question you ask is basically: can there be more than 32 sound cards in a system controlled by ALSA? Obviously, although your USB controllers know all the sound cards you plugged in, the ALSA system does not.

Go to kernel sources to check what happens here. /sound/core/sound.c more information on maximizing sound cards:

  39 static int cards_limit = 1; 40 41 MODULE_AUTHOR("Jaroslav Kysela < perex@perex.cz >"); 42 MODULE_DESCRIPTION("Advanced Linux Sound Architecture driver for soundcards."); 43 MODULE_LICENSE("GPL"); 44 module_param(major, int, 0444); 45 MODULE_PARM_DESC(major, "Major # for sound driver."); 46 module_param(cards_limit, int, 0444); 47 MODULE_PARM_DESC(cards_limit, "Count of auto-loadable soundcards."); 48 MODULE_ALIAS_CHARDEV_MAJOR(CONFIG_SND_MAJOR); 49 50 /* this one holds the actual max. card number currently available. 51 * as default, it identical with cards_limit option. when more 52 * modules are loaded manually, this limit number increases, too. 53 */ 54 int snd_ecards_limit; 55 EXPORT_SYMBOL(snd_ecards_limit); 

From the code and its comments, I read two things:

  • The variable card_limit is a module parameter. I assume that setting this parameter is set to 32. If ALSA support is built into the kernel, you can create your own kernel in which you change this setting. If ALSA support is not built-in but loaded as a module, you can set this parameter during module loading. To do this, you either change the system configuration ( man modprobe.d ) or unload the module, then reboot it using the ( man modprobe ) option.

  • The described limit limits the number of automatically loaded sound cards. To overcome this limit, you may need to manually download the module that is responsible for your sound cards. There are no restrictions in the kernel for adding sound cards manually.

Source: Kernel 2.8 Git

+7
source

A sound card restriction is defined as the SNDRV_CARDS symbol in include/sound/core.h

When I increased this seven years ago, I did not go beyond 32 because the map index is used as the bit index for the snd_cards_lock variable in sound/core/init.c , and I did not want to change more than necessary.

If you make snd_cards_lock 64-bit variable, change all calls to use the 64-bit type and configure any other side effect that I could forget about, you should be able to get the kernel for more ALSA Maps.

This limit also exists in the alsa-lib package; you will need to change at least the snd_ctl_hw_open check in src/control/control_hw.c .

+3
source

All Articles