37.2 Audio Sound Drivers

GNU/Linux has two kernel sound drivers: OSS and ALSA. OSS is older and deprecated, being replaced by ALSA. Only one of these can be chosen as your sound driver. ALSA is the one.

On top of this ESD and ARTS are audio servers that accept requests from programs to play a sound, and then pass those sounds to the kernel sound drivers. Most GNOME applications use ESD, most KDE applications use ARTS, and some applications, like XMMS, can use either.

Traditional Linux kernel sound drivers are single-channel so that only one application can deliver audio to /dev/dsp at a time. Thus, if you were listening to music other sound events would not be heard. ESD and ARTS support multiple channels by multiplexing them and streaming the resulting audio to /dev/dsp. Some newer sound cards/chipsets support multiplexing in hardware and ALSA will make use of this.

Other functionality ESD and ARTS support includes streaming the audio to another machine.

Various commentary suggests that ESD has lower sound quality due to poor processing routines while ARTS has higher latency due to its more complex processing routines!

37.2.1 Aduio Multiple Sound Cards

{#sec:sound-multi}

Generally, any onboard sound card identified is set as the default on boot (/dev/dsp). Additional sound cards (e.g., the SB Live! on Athene) are identified as alternatives (/dev/dsp1, etc.).

[080511] To make the alternative sound card the default there have, historically, been several approaches, and has not always been simple. The simplest, and currently suggested approach, is to use the asoundconf command. First, list which sound cards you have available:

$ asoundconf list
Names of available sound cards:
ICH5
Live

Here, the onboard sound card is listed first (and hence is the default). To set the better quality Live card as the default:

$ asoundconf set-default-card Live
$ asoundconf list
Names of available sound cards:
Live
ICH5

Some older and more difficult approaches have included setting up the appropriate configuration file (/etc/modprobe.d/sound). For Athene this involved:

  alias snd-card-0 snd-emu10k1x
  alias snd-card-1 snd-intel8x0

Another approach was to load the appropriate modules in the order we wish them to be assigned in /etc/modules. For Athene this involved:

  snd-emu10k1x
  snd-intel8x0

To use the ALSA drivers you simply need to install the right packages (for a 2.6 kernel or newer):

  $ wajig install alsa-base alsa-utils alsa-oss

Then configure the sound card(s) using alsaconf. This allows the selection of one sound card from many, if you have more than one. Select one will ensure, right there, that the appropriate modules are loaded and /dev/dsp will be set up appropriately. This directly modifies /etc/modprobe.d/sound so if you have modified it yourself don’t use alsaconf.

Once your have the card working, perhaps with alsaconf, run a mixer (e.g., alsamixer to set the volume control:

  $ alsamixer

And store the default volume settings you have chosen with:

  $ alsactl store

If multiple cards are configured to run at the same time (i.e., not using alsaconf as above, but instead loading modules for both cards) then some audio applications allow or need the selection of the desired device for the output, usually by selecting the card model. This is true for xmms although, when using ALSA, the OSS option seems to work whilst the ALSA one does not?

A second sound card can also be accessed using the GNOME mixer if both cards are enabled:

From a command line:

  $ alsamixer -c 1

An alternative, if rather messy, way to make the second sound card the default, you could add the following code to the end of /etc/init.d/bootmisc.sh, where the second sound card is /dev/dsp1:

DEFAULTCARD=1
for f in dsp audio mixer ; do
  mv /dev/$f /dev/${f}0 ;
  ln -s /dev/${f}${DEFAULTCARD} /dev/${f} ;
done

% ### Configuring Your Audio Chip

% Use the Debian package sndconfig to automatically % identify your audio chip and to add this information to % /etc/modutils/sndconfig.

% If the audio device is not supported then you will probably need to % get a newer kernel. Suppose you has an i810 audio chip (82801DB % AC’97). Get this information from the lspci command: %

%   $ lspci ...  00:1f.5 Multimedia audio controller: Intel Corp.
%   82801DB AC'97 ...
% ```% $
% The PCI ID here is `82801`.  Look this up in
% `/usr/src/linux/drivers/sound/i810_audio.c` and if it's there,
% it should be supported. 

## Audio Not Working
 {#sec:audio-not-working}

If you notice that a user starts up GNOME and receives a message about
Audio not working the likely cause is that the user is not in group
\UnixGroup[]{audio} (as no users are in group \UnixGroup[]{audio} by
default). You need to:

```bash
  # adduser kayon audio

Next time user kayon logs on they will be able to use the audio device.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0