Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need more than 32 USB sound cards on my system [closed]

I'm working on an educative multiseat project where we need to connect 36 keyboards and 36 USB sound cards to a single computer. We're running Ubuntu Linux 12.04 with the 3.6.3-030603-generic kernel.

So far we've managed to get the input from the 36 keyboards, and recognized the 36 sound cards without getting a kernel panic (which happened before updating the kernel). We know the 36 sound cards have been recognized because $ lsusb | grep "Audio" -c outputs 36.

However, $ aplay -l lists 32 playback devices in total (including the "internal" sound card). Also, $ alsamixer -c 32 says "invalid card index: 32" (works just from 0 through 31 ; 32 in total too).

So my question is, how can I access the other sound cards if they're not even listed with these commands? I'm writing an application in python and there are some libraries to choose from, but I'm afraid they'll also be limited to 32 devices in total because of this. Any guidance will be useful.

Thanks.

like image 846
picheto Avatar asked Jan 07 '13 18:01

picheto


People also ask

Are sound cards obsolete?

These components are designed to take the specialized job of parsing signals into quality sound, a task that the computer's CPU is not intended for. Audio interfaces have largely made the humble sound card obsolete.

Does USB sound card improve sound quality?

Yes, it will improve the audio performance of your computer which is a good thing. But a sound card is also the key to using your computer for mixing or capturing a performance. A sound card will have audio inputs (RCA, 3.5mm and optical are common options), as well as outputs—and some include a MIDI port as well.

Do people still buy sound cards for PC?

For years, getting a dedicated sound card for your PC was a given because it was the only way to get quality sound. Modern PCs, however, have good audio hardware built into their motherboards. But dedicated sound cards still exist.

Can you have multiple sound cards?

A multiple sound card system in a computer can lend versatility and control to a computer sound system, but this type of setup can also cause a few problems. High-powered sound cards can be bulky and get in the way of other hardware or computer cooling.


2 Answers

The question you pose is basically: Can there be more then 32 sound cards in the system controlled by ALSA? It obviously seems that while your USB controllers know all sound cards you attached, the ALSA system does not.

Let's get into the kernel sources to check what's going on here. In /sound/core/sound.c you will find more information about the issue of maximum sound cards:

  39 static int cards_limit = 1;
  40 
  41 MODULE_AUTHOR("Jaroslav Kysela <[email protected]>");
  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's 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:

  1. The variable cards_limit is a module parameter. I assume that on your installation this parameter is set to 32. If ALSA support is built into the kernel you can build a custom kernel where you changed this option. If ALSA support is not built-in, but loaded as a module, you can set this parameter during module load. For this you either change your system config (man modprobe.d) or unload the module, then reload it with the option (man modprobe).

  2. The limit is described to only limit the number of automatically loaded soundcards. To overcome this limit, it may suffice to manually load the module responsible for your soundcards. There is no limit set in the kernel for manually added soundcards.

Source: Kernel 2.8 Git

like image 108
ypnos Avatar answered Oct 06 '22 18:10

ypnos


The sound card limit is defined as the symbol SNDRV_CARDS in include/sound/core.h.

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

If you make snd_cards_lock a 64-bit variable, change all accesses to use a 64-bit type, and adjust any other side effect that I might have forgotten about, you should be able to get the kernel to have more ALSA cards.

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

like image 32
CL. Avatar answered Oct 06 '22 18:10

CL.