SDB:Audio troubleshooting

Jump to: navigation, search


This guide is intended to help provide basic sound to openSUSE users whose sound does not work at all after a new openSUSE install. This guide is not intended to show how to install codecs.

General

Not all of the steps in this troubleshooting guide will be necessary. Just work your way through the sections, stopping when your audio starts to work.

This guide is written generically. It has the greatest likelihood of helping a user if they do not deviate from the nominal openSUSE packaged drivers; desktop and kernel. That is, if one installs a custom kernel or updates to a factory KDE version (as opposed to remaining with the nominal KDE version), or applies a manufacturer-provided sound driver, there is an increased probability that this guide will not be of help.


Firmware

After openSUSE installation, in some cases it is necessary to adjust the audio mixer settings in order to get sound. For some sound codecs, the RPM "alsa-firmware" (which is not installed by default) is needed to provide sound functionality. In other cases where the audio hardware is newer, a more up-to-date version of ALSA is required. Some newer sound cards may require "sof-firmware" to support drivers implemented as part of the Sound Open Firmware Project. The journal can be checked for messages relating to firmware if necessary.

sudo journalctl -b | grep firmware

ALSA overview

ALSA (Advanced Linux Sound Architecture) consists of the kernel sound device drivers needed to support various audio hardware devices. It also includes low-level user-space libraries (providing a unified application programming interface) for application developers, and CLI utilities for users as well. Manual installation and configuration is not normally necessary, as udev will automatically detect hardware at boot time, and relevant drivers are loaded accordingly.


Installing alsa-firmware on openSUSE

Some of the older sound cards also require the “alsa-firmware” package in addition to “alsa” and “alsa-utils”. Thus, before proceeding, ensure that you have “alsa”, “alsa-utils”, and “alsa-firmware” installed. It appears that installing the alsa-firmware package may help users with: asihpi (dspxxxx), ea (gina, indigo, layla, mona), emagic (emi), ess (maestro), mixart, multiface, pcxhr, sb16, vx, yamaha, C-Media and some other chipsets.

To see if you have alsa-firmware installed, type the following command in a terminal:

rpm -q alsa alsa-utils alsa-firmware

and if you get:

alsa-1.0.14-31.2
alsa-utils-1.0.14-27
package alsa-firmware is not installed

then alsa-firmware is not installed.

To install alsa-firmware in openSUSE:

sudo zypper in alsa-firmware

After alsa-firmware is installed, restart your machine, or otherwise make sure the kernel's sound modules are reloaded. Check your sound (refer 'How to test your sound' below), and if need be, restart the ALSA service with the command below, via a terminal:

sudo systemctl restart alsasound

How to test your sound

A simple test to see if your sound works, is to open a terminal, and type or copy-paste:

speaker-test -Dplug:front -c2 -l5 -twav

Note that Linux is case sensitive, and “D” is not the same as “d”. Hit CTRL-C to stop the test. Note that you should check your mixer settings (run alsamixer in the terminal, though graphical programs like kmix or pavucontrol may also be used) to ensure that PCM and Master Volume are not muted. If need be, raise the sound levels (or press the "M" key) and retry until you hear sound. Note that the test for surround sound is different.

If that test yields errors, try instead this more simple test:

speaker-test -c2 -l5 -twav

If there is no sound, proceed to the next section.

For systems with multiple sound cards/devices, a list of detected sound PCM devices can be got using

aplay -L

The speaker-test utility can be configured to specify a particular device the -D option. Examples:

speaker-test -c2 -l5 -twav -D hdmi:CARD=NVidia,DEV=1
speaker-test -c6 -l5 -twav -D hdmi:CARD=PCH,DEV=2
speaker-test -c8 -l5 -twav -D plug:surround71

ALSA web site suggestions for testing sound

The alsa-project also has some suggestions for testing one's sound, which are located here: http://www.alsa-project.org/main/index.php/SoundcardTesting


YaST sound configuration

The YaST Sound module is now obsolete. It has been removed from openSUSE Tumblweed, but remains (for now at least) in currently supported openSUSE Leap versions, so this section will likely be removed in the near future. In any case, manual configuration of sound cards is for the most-part not necessary.

Refer https://lists.opensuse.org/archives/list/factory@lists.opensuse.org/thread/7RU37EJFMUS3UEGC23K4FKEXRHRNT5O6/

To configure your sound go to:

  • YAST > HARDWARE > SOUND > OTHER > TEST and test your sound. If you have no sound then,
  • YAST > HARDWARE > SOUND > OTHER > VOLUME and move your PCM and Master Volume up to about 75% and test your sound. If you have no sound then,
  • YAST > HARDWARE > SOUND and select your audio card and delete it (which deletes the configuration, not the card). If you wish to ensure the sound configuration is completely deleted, you will need to delete the file /etc/modprobe.d/50-sound.conf (with root permissions). Then add the card, and configure the card. That will recreate the 50-sound.conf file.

After configuring test your sound, and don't forget to check your desktop mixer, alsamixer, or pulseaudio as appropriate.

If there is still no sound, proceed to the next step.


Checking your audio setup for detailed information

It is often useful to find out more about your sound configuration before proceeding further.

Basic CLI commands

Detailed audio hardware, driver, and server information:

$ inxi -Aa

To find your alsa version:

$ cat /proc/asound/version

To find what sound module(s) you have loaded:

$ cat /proc/asound/modules

To determine the audio codec used by your sound card (and this is important):

$ cat /proc/asound/cards

and look for your audio codec. For example, if you obtained:

0 [nForce2        ]: NFORCE - NVidia nForce2
                     NVidia nForce2 with ALC650F at irq 18

Then for this example, we are interested in the ALC650.

Checking which applications/processes are accessing sound devices:

fuser -v /dev/snd/*

Script to run to obtain detailed information

If that does not provide the codec, then another approach to obtain more information on your hardware and your sound configuration, is to run the following script.

First method to run script

The diagnostic script is the one created by user wishie from IRC #alsa. For users with 1.0.17 of alsa or newer, it is included with alsa. To run, copy and past the line below with root permissions:

/usr/sbin/alsa-info.sh

Often the first time you run this script, it will note there is an update available, and ask if you wish to update. Select YES. If you are running this in a terminal/konsole with root permissions, the script will update. Then run the script a second time. When it is complete, it will pass you a URL. Take a look at the contents of the URL, as it passes to you useful information. Also keep a record of the URL provided by the script as it can come in useful for passing to others who are trying to assist you (on one of the forums, or on an IRC channel). Then go to the next step of this guide.

Keep a record of the URL provided by the script as it can come in useful for passing to other's who are trying to assist you (on one of the forums, or on an IRC channel).

Now take a good look at those script pages, and try to determine what audio codec your PC sound hardware has. For example, it might be an ALC650, or an ALC268, AD1986A, STAC9220, etc...

Alternative method to run script

For those who find the above instructions on running the two diagnostic scripts too challenging, then as a regular user try copying and pasting the following line into a terminal (to both download and run the scripts). Copy the COMPLETE line. You will be prompted for the root password when the script is executed.

# wget -O alsa-info.sh http://www.alsa-project.org/alsa-info.sh && sudo bash alsa-info.sh

Search the alsa site for codec info

Now, armed with that codec information, go to the alsa web site, and do a search to see if there is any relevant information on that codec:

http://www.alsa-project.org/main/index.php/Main_Page

There is a search box on the left hand side of that page (part way down). Lets say your audio codec was ALC268. Then a search for that might indicate:

http://www.alsa-project.org/main/index.php/Special:Search?search=ALC268&go=Go

Doing a search on that page will indicate many changes with this new alsa version for ALC268. In that case, one should consider updating to a newer version of alsa.

If after doing those searches, it appears that the current version of alsa appears adequate, then it is possible you need to do a custom hand edit to your /etc/modprobe.d/sound file and add a model specification (refer to Section 8). But if update to a newer version of alsa appears useful, then go to the next section.


Updating ALSA in openSUSE

If updating alsa is deemed necessary, then this can be done either via rpm or via a tarball. As always, the average openSUSE user should typically try updating via an rpm first, prior to trying via a tarball.

Updating alsa via RPM

For openSUSE, the openSUSE alsa packager / alsa developer also packages the latest alsa as openSUSE rpms, in order to help users whose sound is not functioning appropriately, by providing cutting edge sound drivers.

The rpm applications that are typically updated include alsa, alsa-utils, alsa-tools, and libasound2 alsa-firmware. Note alsa-firmware is in the “noarch” section of that rpm URL. In addition, there are ALSA driver kernel modules to update.

It is often easiest to add the URL of the repository noted in the next section to one's package manager, and install the rpm applications through one's package manager.

RPM commands to update alsa for openSUSE (various kernels)

Specific examples for various openSUSE versions, and for various kernel versions, with specific zypper commands for openSUSE are provided here: SDB:Alsa-update

if after rebooting, the rpms installed after following that URL do not help, then there are also daily alsa snapshots packaged and available here: SDB:Alsa-update-snapshot

The examples in the above URL are important, PLEASE check out that link to see the exact rpm/zypper installation commands you need to use. Again, this is IMPORTANT.

Please check out the above noted URL. It provides a link with exact command examples for various openSUSE and various kernel versions. Note also you can check your kernel (before running the above zypper commands documented in the provided link/URL) by typing:

$ uname -a

To determine your openSuSE version and your system architecture version you can type:

$ cat /etc/os-release

For all openSUSE users, after installing this latest alsa, its easiest to reboot (to reload this updated alsa driver) then again go through all of the previous steps in this page, to see if you can get your sound working under the new alsa. Note one may still not have sound, and you may need to edit your /etc/modprobe.d/sound file (refer Section 8), and add a model specification. Also, if the above alsa update restores your sound, then be careful about applying further updates of alsa. The alsa rpms on this web site are very "cutting edge", they are built regularly, and they could have recently introduced bugs that have not been fixed yet. Hence once you get your sound working, you should remove this "cutting edge" multimedia repository (while still keeping the installed rpms).

Updating alsa via tarball

One can also custom compile alsa for their PC by going to the URL below and downloading the alsa tarballs alsa-driver, alsa-firmware, alsa-lib, alsa-utils, and alsa-tools: http://www.alsa-project.org/main/index.php/Download A note of caution, ... this sort of update via a custom compile of alsa from tarball is typically not for new users. Try instead to follow the rpm update method via zypper command, described above.

The readme.txt and install.txt provide instructions for compiling from tarball. In addition, custom installation instructions can also be found on the alsa web site. In our case, for the ALC268, the kernel sound module for this is the: snd-hda-intel (which we learned above when typing: cat /proc/asound/modules ). Searching the alsa site for snd-hda-intel gives this page which provides custom instructions for compiling alsa: http://www.alsa-project.org/main/index.php/Matrix:Module-hda-intel

The same is true for most sound modules. Once alsa is compiled and installed, restart one's PC to load the sound module, then again go through all of the previous steps in this page, to see if you can get your sound working under the new alsa. Note one may still not have sound, and one may wish to modify their /etc/modprobe.d/sound file per the recommendations of the alsa page, or one may wish to try and edit to their /etc/modprobe.d/sound file (by adding a model specification) as noted below.


Add “model” to /etc/modprobe.d/<file> file

To specify the model of your sound card explicitly with openSUSE, you first need to determine what model specification to apply. There is an ALSA-Configuration.txt file on your PC that you can examine (in a directory something like the following, dependent on your kernel version): /usr/src/linux-2.6.22.13-0.3/Documentation/sound/alsa/ALSA-Configuration.txt

There is also an up to date ALSA-Configuration.txt file here: http://hg.alsa-project.org/alsa-kernel/raw-file/5082de4abb26/Documentation/ALSA-Configuration.txt

As of 1.0.19 of alsa, the HD-Audio-Models options are listed in the HD-Audio-Models.txt file.

There is an excellent example how to do this manual configuration here: SDB:Intel-HDA_sound_problems

In our example of the ALC268, you will see:

ALC268
  3stack        3-stack model
  toshiba       Toshiba A205
  acer          Acer laptops
  dell          Dell OEM laptops (Vostro 1200)
  zepto         Zepto laptops
  test          for testing/debugging purpose, almost all controls can
                adjusted.  Appearing only when compiled with
                $CONFIG_SND_DEBUG=y
  auto          auto-config reading BIOS (default)

The next step is to edit /etc/modprobe.d/50-sound.conf and look for a line that looks something like:

options snd-hda-intel enable=1 index=0

Add a model specification on the end of that line.

As an example (for the ALC268 codec), if you clearly have an “acer” or “toshiba” laptop computer, then the choice as to what you can try first is clear. But its still possible one of those will work with your audio, even if your hardware is not that of an “acer” nor “toshiba” and you should iteratively still try those models.

So for example (to use the toshiba model option) the model is specified like this:

options snd-hda-intel model=toshiba

Save the file, and restart your alsa driver, by typing in a terminal with root permissions:

# systemctl restart alsasound

Then test your sound with the sound test provided at the start of this web page. Don't forget to check your mixer is not muting nor blocking the sound.

If that doesn't work, then the process can be repeated, choosing a different model, and trying again. (Remember to restart alsasound between each edit.)

Some of the more complex hardware codec examples, for example the ALC880:

ALC880
  3stack        3-jack in back and a headphone out
  3stack-digout 3-jack in back, a HP out and a SPDIF out
  5stack        5-jack in back, 2-jack in front
  5stack-digout 5-jack in back, 2-jack in front, a SPDIF out
  6stack        6-jack in back, 2-jack in front
  6stack-digout 6-jack with a SPDIF out
  w810          3-jack
  z71v          3-jack (HP shared SPDIF)
  asus          3-jack (ASUS Mobo)
  asus-w1v      ASUS W1V
  asus-dig      ASUS with SPDIF out
  asus-dig2     ASUS with SPDIF out (using GPIO2)
  uniwill       3-jack
  fujitsu       Fujitsu Laptops (Pi1536)
  F1734         2-jack
  lg            LG laptop (m1 express dual)
  lg-lw         LG LW20/LW25 laptop
  tcl           TCL S700
  clevo         Clevo laptops (m520G, m665n)
  test          for testing/debugging purpose, almost all controls can be
                adjusted.  Appearing only when compiled with
                $CONFIG_SND_DEBUG=y
  auto          auto-config reading BIOS (default)

You need to determine how many jacks your hardware has (take a look) to see if it is applicable to try the 3-stack, or the 5-stack, or the 6-stack, or an S/PDIF output interface ... then you may be able to narrow down what options you try, to find the optimal setting earlier.

Try each of the model options by adding "model= ...... " to the relevant configuration entry (as per above). Don't forget to restart alsasound after each attempt.

Warning! Don't put any backup files of 'sound' (or backups of anything else) in /etc/modprobe.d/ as this would also be read and loaded! Put your backups somewhere else.


PulseAudio

Commencing with openSUSE-11.0, PulseAudio was introduced in openSUSE. For guidance on how to deal with some Pulse Audio problems, please refer to

Since openSUSE 11.4, KDE has had PulseAudio installed and active by default. Gnome has had PulseAudio even before then. In such a case, it can be useful for KDE users to install the application PulseAudio Volume Control (pavucontrol) and use that application to tune one's audio for each multimedia application. Gnome users may find pauvcontrol already installed by default. LXDE users will find that they will first need to install PulseAudio (as PulseAudio was not automatically installed in LXDE as of openSUSE 12.1 and earlier), and subsequently install pavucontrol.

To install pavucontrol (if not already installed), type

su -

followed by the root password when prompted, then type:

# zypper in pavucontrol

After it is installed, type "exit" or press CTRL+D to close the root session. Launch it by typing

pavucontrol

The first time you run each application, tune PulseAudio for that application, ensuring you have each application tuned to use the correct audio device. It is useful to install other PulseAudio utilities, such as "pasystray".


A possible fix to choppy / skipping sound

The PulseAudio sound server was written to use timer-based audio scheduling instead of the traditional interrupt-driven approach. This is the approach that is taken by other systems such as Apples CoreAudio and the Windows Vista audio subsystem and has a number of advantages, not the least in reduced power consumption, minimization of drop-outs and flexible adjustment of the latency to the needs of the application. However, timer-based scheduling may expose issues in some Alsa drivers. To turn timer-based scheduling off, replace the line load-module module-hal-detect in /etc/pulse/default.pa by load-module module-hal-detect tsched=0 Alternatively, in cases where udev is used instead of hal, try replacing the line load-module module-udev-detect in /etc/pulse/default.pa by (or adding if that line not present) load-module module-udev-detect tsched=0

In other cases, choppy sound in pulsaudio can result from wrong settings for the sample rate in /etc/pulse/daemon.conf . Try changing the line default-sample-rate = 44100 in /etc/pulse/daemon.conf by default-sample-rate = 48000 and restart the PulseAudio server.


PipeWire

Refer openSUSE:Pipewire




Determine the order of sound devices

With the advent of video cards with HDMI outputs, a lot of computers now have more than one sound device. The sound card order can impact users, with the sound getting sent to the wrong device. For most users, PulseAudio and PipeWire help to take care of this, and provide configuration tools to set the deisred sinks (device outputs) and sources (device inputs) as required. Manual configuration at the ALSA level can be achieved by creation of a suitable .conf file in the /etc/modprobe.d`/ as described in the next section.

Intel HDA chipset

Consider the example where your Intel hardware has the default audio order of "HDMI" first and then "PCH" (analog) second.

In order to change the order, open /etc/modprobe.d/50-sound.conf and change it to:

alias snd-card-1 snd-hda-intel
alias snd-card-0 snd-hda-intel

options snd-hda-intel id=PCH index=0
options snd-hda-intel id=HDMI index=1

For the "id" to use, see the output of

aplay -l

Configuring the microphone

Check available ALSA input devices (including microphones) are present using

arecord -lL
pactl list sources

Use pavucontrol to ensure the correct profile (Configuration tab) and appropriate port (Input Devices tab) is chosen, not muted, and level set as desired.


Configuring a bluetooth headset

Refer SDB:Bluetooth



Configuring USB headphones

In general, udev should handle such devices dynamically (courtesy of pipewire-modules rules), and PipeWire should then direct audio accordingly.

If not, start by examining the output of:

pactl info
pactrl list sinks
wpctl status

and perhaps seek help in the openSUSE Forums.

Also, check if restarting the following services helps:

systemctl --user restart pipewire pipewire-pulse

Configuring a laptop's multimedia keys

Refer to the following wiki guides:

Determining which application is using sound device


Sometimes, when one has basic sound functioning, but then it appears to stop in the middle of a session (to be restored after a reboot) it may be because an application has seized your audio device, and the application is not sharing nor letting go the audio device. To determine what application is using one's sound device, copy and paste the following into a terminal:

$ lsof /dev/dsp* /dev/audio* /dev/mixer* /dev/snd/*

If one runs the above line at different times, when one's sound is working and not working, one can learn better as to what the output means, and be better able to "point one's finger" at the offending application that has seized the audio device.


ALSA driver documentation

One can read up on the technical aspects of alsa by installing the rpm "alsa-docs" and then copying into one's web browser: file:///usr/share/doc/packages/alsa-docs/index.html


Some magic

to test your sound from command line

aplay -vv /usr/share/sounds/alsa/Front_*

to test the microphone

arecord -d 10 myrecording.wav

and

aplay -vv myrecording.wav

to check the recording.


External links