Ubuntu Linux - Linux Audio Subsystem Introduction & Troubleshooting Guide komputes Version 0.3 - For use with console-presenter 1 - Make sure that the sound system is turned on and the hardware volume regulator is up. 2 - Check software volume levels for low/muted volume. ◦ You can also run the following commands to make volume adjustments $ alsamixer #Will bring up PulseAudio abstract volume $ alsamixer -c0 # Will bring up ALSA volume levels for Card 0 3 - Listing sound cards. ◦ There are multiple ways of doing this... Listing sound cards ◦ $ cat /proc/asound/cards $ aplay -l $ lspci -v | grep -A10 -i audio $ hwinfo --sound $ cat /dev/sndstat 4 - Make sure the user has permissions to use audio devices in System > Administration > Users and Groups ◦ You can also do this via CLI by making sure that the username is part of the "audio" group. ◦ $ grep audio /etc/group 5 - Try different sound server (i.e. revert to ALSA). ◦ Go to System > Preferences > Sound ◦ Change all options from Auto-Detect to ALSA ◦ In a terminal (Applications > Accessories > Terminal) type in the command: ◦ $ killall pulseaudio ◦ In 8.10 and upgraded releases, you will want to turn off PulseAudio session manager (at boot) by going into System > Preferences > Sessions and uncheck "PulseAudio Session Management" 6- Try to remove the user sound configuration file and restart a session: ◦ $ rm ~/.asoundrc ~/.pulse/ ~/.pulse-cookie 7 - BIOS options can allow or stop audio from working in the operating system. Check BIOS settings to see if there is anything relating to audio. It is also recommended to reset BIOS settings to default and try again. 8 - Try to diagnose conflicting modules. If you find one, report it as a bug. ◦ $ lspci -nnk ◦ If you run this command and see more than one module listed for one card, it's possible that you have a conflict. ◦ If this is the case you may need to blacklist the module which is interfering by adding it to /etc/modprobe.d/blacklist(.conf in jaunty+) 9 - Now that you know the model and PCI ID of the card, you now want to see the "Codec" or how the sound card is wired. To lookup the codec of the card use the following command: ◦ $ cat /proc/asound/card*/codec* | grep Codec 10 - Make sure the following packages are installed ◦ $ sudo apt-get install linux-ubuntu-modules-`uname -r` linux-generic 11 - Is sound card supported? Check the ALSA SoundCard Matrix page to check. ◦ If NOT you can A - Contact developers to get card supported B - Go out and buy yourself a compatible sound card 12 - Is the card supported but needs an option/quirk applied? ◦ Quirk/Option details for particular cards can be found in /usr/share/doc/alsa-base/driver/ALSA-Configuration.txt.gz ◦ Changes are made in: /etc/modprobe.d/alsa-base [Before Jaunty] /etc/modprobe.d/alsa-base.conf [After Jaunty] 13 - Run ubuntu-bug alsa-base to create a bug on Launchpad. ◦ The alsa-info.sh script from ALSA contains detailed information concerning the sound hardware. Include the output file/URL in the bug you are reporting. ◦ If you need to add information to an existing bug (to bug #696969 for example) run "apport-collect -p alsa-base 696969". Now for random notes! All your alsa-base are belong to us! If you are troubleshooting one or multiple USB audio devices. You may want to add the following line to set the sound card index number: ◦ $ sudo nano /etc/modprobe.d/alsa-base (alsa-base.conf in Jaunty+) ◦ # and add the following text # options snd-usb-audio index=1 ◦ # and then restart alsa with the following command# /etc/init.d/alsa-utils restart All ALSA modules are named thn the following manner: snd- via82xx ◦ If you need to load a module at startup, add the module name to /etc/modules ◦ If you need to do this manually, you should report that it is not auto-detected it to Launchpad ◦ To check the snd modules which are loaded, use the following command: $ lsmod | grep snd Resetting back to default - The official ubuntu sound stack core sudo aptitude --purge reinstall linux-sound-base alsa-base alsa-utils linux-image-`uname -r` linux-ubuntu-modules-`uname -r` libasound2 Profiles Profiles for a machine can be saved and loaded. ◦ Saving a copy: $ cp /var/lib/alsa/asound.state /media/disk/ ◦ Loading a preset: $ alsactl -F -f asound.state restore Older programs may expect ALSA, for this there is a command called pasuspender which will temporarily suspend PulseAudio for a particular process and route audio directly through ALSA. ◦ ◦ In the following example we will disable PulseAudio for the arecord command ◦ $ pasuspender -- arecord -D plughw:0 $ arecord -D plughw:0 file.wav Older programs and some games may expect OSS, for this there is an OSS module for ALSA ◦ $ sudo apt-get install alsa-oss ◦ Usage: $ aoss quake MIDI support MIDI data is usually transfered on port 330, for this reason, we may need to specify this in /etc/modprobe.d/alsa-base in the following manner: ◦ options snd-maudio mpu_port=0x330 Frequently asked questions What are the different names associated to output/input devices depending on the sound server which is naming/abstracting them? ◦ Most, if not all, sound servers present "Playback" and "Capture" views. Some of these are slightly different, e.g., "Recording" vice "Capture". Few people have trouble choosing the appropriate view, however, given the prevalence of audio machinery in the real world. ◦ PulseAudio is consciously choosing to present only Playback and Recording views as logical abstractions. From the physical devices, there are Output Devices and Input Devices. ◦ GSt and Xine-lib, when using PulseAudio, present PA's views. ◦ ALSA currently chooses to present Playback and Capture. ◦ GSt and Xine-lib, when using ALSA, present ALSA's views. ◦ Phonon, whether using GSt or Xine-lib, present the appropriate backend's views (so, either ALSA or PulseAudio). Would it be possible to run two or more sound servers at the same time. Is ALSA considered a "server" or does that term apply to PA and JACK? ◦ If there is only one audio device in the machine capable of playback and recording, then *generally*, it's not possible to have two or more sound servers running at the same time using the same device. This is the case due to most modern audio controllers having removed/omitted support for hardware multiopen as the older EMU (Sound Blaster Awe/Live), Aureal Vortex (Turtle Beach), and Cirrus Logic had. ◦ Once one introduces another audio device, it instantly becomes possible to run multiple sound servers, since it's (fairly) trivial to tell different sound servers to use different devices. ◦ Anything providing a "client" interface for audio is considered a client-server architecture. In this fashion, ALSA is as much a server as PA and JACK. ◦ *However*, most people don't think of ALSA in the traditional "play my music across a network" sense. PA does this, netjack does this, etc. What are the important files are associated to ALSA? ◦ /var/lib/alsa/asound.state (system wide ALSA library definition for logical devices) ~/.asoundrc (user specific ALSA library definition for logical devices) /usr/share/alsa/alsa.conf ubuntu makes specific changes here to support PA and bluez /etc/asound.conf is the canonical system-wide ALSA library definition for logical devices ◦ These files that allow for (re)defining ALSA library logical configurations manipulate which audio device is chosen as default (at runtime, or application invocation), how specific channels are routed between multi-channel devices, etc. How does PulseAudio work in relation to ALSA? Currently ALSA talks to the audio devices and load proper sound modules to make them work. PA uses whatever ALSA hands it. ◦ Here is an example of the layers at work: -- Rhythmbox -- -- GStreamer -- -- PulseAudio -- -- Alsa-lib -- -- /dev/snd/* -- -- Alsa-kernel / linux -- -- audio hardware -- ◦ PulseaAdio was first shipped with Ubuntu 8.04; as of 8.10, all native ALSA apps are exposed/routed through the pulse alsa-lib pcm+ctl plugins. The pulse alsa-lib pcm+ctl plugins are shipped in libasound2-plugins (from the alsa-plugins source package) This is what it looks like if you are only using ALSA (Previous to Ubuntu 8.04): -- Rhythmbox -- -- GStreamer -- -- Alsa-lib -- -- /dev/snd/* -- -- Alsa-kernel / linux -- -- audio hardware -- How does one unload a snd-module? Usually with modules, rmmod should do the trick, but there must be a simple way to turn off the card which is in use before removing the module. Trying to unload the module with rmmod will dive you this error $ sudo rmmod snd-hda-intel $ ERROR: Module snd_hda_intel is in use ◦ In Ubuntu, this step would be: sudo /sbin/alsa force-unload ◦ The command takes care of killing processes using the sound devices and unloading the sound driver modules in order. How to tell whether two sound modules are interfering with each other? ◦ If two modules are assigned to a sound card (in lspci -vv) there may be a conflict. Known/frequent conflicts include: ◦ nvsound conflicts with snd-intel8x0 emu10k1 conflicts with snd-emu10k1 ac97_codec conflicts with snd-ac97-codec via82cxxxaudio conflicts with snd-via82xx ◦ None of the above should be a problem in Ubuntu; we decided many releases ago to ship ALSA and not OSS. ◦ snd-ca0106 & ALSA X-Fi driver all conflict with with snd-hda-intel