Hi All,
If you’ve installed openSUSE 11.2 and are having problems with your audio clicking, popping, stuttering, being delayed, high cpu usage, and freezing up, this thread might be for you.
Background: Audio problems like this are normally caused by a sound server called PulseAudio, which is another layer above the ALSA soundsystem. I’m not exactly sure what PulseAudio is supposed to do, but completely removing it has fixed a variety of problems on my machine, so I wanted to share my method as a resource to others.
Procedure Overview: PulseAudio cannot be simply disabled, it must be removed completely. Especially if using the GNOME desktop, the removal process is not entirely straighforward.
Step 1–Free ALSA from PulseAudio: When PulseAudio is installed with GNOME, the ALSA sound system is configured to output everything through PulseAudio, via the file installed at /etc/asound-pulse.conf. The situation can be remedied by using the following commands (requires root authorization):
Backs up the existing file:
mv /etc/asound-pulse /etc/asound-pulse.bak
I’m not sure if this is really necessary or not, but the following commands will create a new asound-pulse file with sensible default settings; it has been working for me so far.
cat /usr/bin/asoundrc
#!/bin/bash
# asoundrc v0.1.0 20090101 markc@renta.net GPLv3
# asoundrc v0.2.0 20090320 quatro_por_quatro@yahoo.es GPLv3
#
# A simple script to create a particular default audio device regardless
# of what cards are loaded or in what order. It could be used anytime or
# placed in a ~/.bashrc script for a persistent setup every login.
#
# Usage: asoundrc [DEFAULT_CARD] > ~/.asoundrc
# use the first parameter as the card name, or else
# look for the sound card, discarding those that are only microphones
# when there are multiple cards, use the first one
if default_card="${1:-$(cat "$(for f in $(ls -1 /proc/asound/card[0-9]*/{midi,codec}* 2>/dev/null); do echo "${f%/*}"; done \
| sed -e '\|^\:blank:]\]$|d' -e 'q')/id" 2>/dev/null)}"; then
echo "Using sound card: ${default_card}" >&2
cat /proc/asound/card[0-9]*/id | \
gawk --assign default_card="${default_card}" \
'{print "pcm."$1" { type hw; card "$1"; }
ctl."$1" { type hw; card "$1"; }" }
END {print "pcm.!default pcm."default_card"
ctl.!default ctl."default_card}'
else
echo "Warning: No sound cards found." >&2
fi
chmod 755 /usr/bin/asoundrc
asoundrc /etc/asound-pulse
Step 2–Remove PulseAudio and Install a Package Lock: The following commands will remove PulseAudio and lock it so that it is never installed on your system again:
First we will remove all PulseAudio packages, leaving other GNOME packages untouched.
rpm -e --nodeps `rpm -qa | grep pulse`
Next, we will add a lock to all of the PulseAudio packages, which will prevent them from being reinstalled when you do updates or install other packages. You can test if this worked by going into YaST Software Management after adding the lock, and see if it prompts you to install any PulseAudio packages.
zypper al *pulse*
Step 3–Reconfigure Applications to use ALSA: The above setup will work fine for programs that output sound to ALSA directly, but apps such as Gstreamer (Banshee, Totem) and SDL (Sauerbraten, Nexuiz, etc) need to be reconfigured before you’ll have sound. Use the following commands to restore sound to these applications through ALSA:
We will open the GUI where you can change Gstreamer’s output to ALSA. This will enable sounds for applications like Banshee and Totem.
gstreamer-properties
Here, we will edit the gnome startup script to enable sound on SDL apps like Sauerbraten, and a few others, mostly games. Scroll to the bottom of the file (line 101 in my file) and edit the line “export SDL_AUDIODRIVER=pulse” to “export SDL_AUDIODRIVER=dsp”. I’m not sure why this works, (“dsp” is generally an OSS thing) but it was the only way I could get sound on these apps.
vi /usr/bin/gnome
Now log out and log back in, or do init 3 followed by init 5, or reboot, and everything should be working.
I did the above steps and now sound is (hopefully) working as expected on my machine; I just got it working last night so hopefully there are no other problems. Please post any improvements or simplifications to this method… hopefully we can save somebody the six hours of research and trial-and-error it took me to find a workable solution.