Sound

From LQWiki
(Redirected from AudIO)
Jump to navigation Jump to search

This article deals with the Linux sound configuration. For sound formats, see sound file formats. For Sound TroubleShooting, see TroubleShooting sound.

OSS and ALSA

Here are two major sets of Linux sound drivers, ALSA and OSS. OSS only allows for one application at a time to have access to the sound card, but can be used on many UNIX systems. ALSA allows several applications to share sound card access, but can only be used on Linux. ALSA emulates OSS by providing a device /dev/dsp. If you can call alsamixer on your system, your sound system is most probably ALSA.

Configuration

You should always configure sound by means of your distribution, so, find out your distribution.

Red Hat

Use the command

sndconfig

SUSE

Use the command

yast2 sound

Generic

You will need to make sure your sound card drivers are loaded. For this you have a file /etc/modules.conf or /etc/modprobe.conf. Use the command

alsaconf

which will do this for you. At the end you should see a file /dev/dsp and you should be able to play random noise with the command (issued as root, stop it with CTRL_C)

dd if=/dev/urandom of=/dev/dsp

If you hear a sound, configure your mixer:

alsamixer

The users who shall be able to play sound must be added to the audio group like this:

# adduser joeuser audio

Manual Configuration

Use the command hwinfo to find out what driver you need to load. It gives you a driver activation command:

# hwinfo --sound
16: PCI 1b.0: 0403 Audio device
  [...]
  Model: "Intel 82801I (ICH9 Family) HD Audio Controller"
    Driver Activation Cmd: "modprobe snd_hda_intel"
  [...]

Tips

  • test if the sound works, excluding mixer (use CTRL-C to stop the sound):
cat /dev/urandom >/dev/dsp

If you hear a sound after that command, you can be sure

  • your user is allowed to play sound
  • you loaded the correct sound driver
  • you have your speakers working and on enough volume

If you cannot hear a sound, check the above points.

If one is positive that one has the right module, but the sound still is not working, then try reading the comments at the top of the driver's source code for help. For instance, the SiS7012 onboard soundcard only runs at 4800hz. The source code for the i810_audio OSS/Lite driver explicitly notes this problem, and says that only apps such as xmms will work, while mpg123 will not.

Alternatively, try updating the Linux kernel.

See also