SDB:Pulseaudio

Jump to: navigation, search
PulseAudio is a networked sound server that allows software mixing of audio. See the PulseAudio website for more details.

Tested on openSUSE

Recommended articles

Icon-manual.png

Related articles

General

PulseAudio provides:

  • Software mixing of multiple audio streams, bypassing any restrictions the hardware has.
  • Network transparency, allowing an application to play back or record audio on a different machine than the one it is running on.
  • Sound API abstraction, alleviating the need for multiple backends in applications to handle the wide diversity of sound systems out there.
  • Generic hardware abstraction, giving the possibility of doing things like individual volumes per application.

PulseAudio comes with many plugin modules. All audio from/to clients and audio interfaces goes through modules. PulseAudio clients can send audio to "sinks" and receive audio from "sources". A client can be GStreamer, xinelib, MPlayer or any other audio application. Only the device drivers/audio interfaces can be either sources or sinks (they are often hardware in- and out-puts).


Configuration

PulseAudio is enabled by default in openSUSE installations. The daemon is automatically started if an application tries to use pulseaudio. Logging in to KDE or Gnome desktop environments will trigger it to start for example.

If you are having issues with PulseAudio, before reporting them to our Bugzilla, make sure you read the perfect PulseAudio setup. It contains information about making all available sound systems use PulseAudio for the actual sound playing. If on the other hand you wish to disable pulseaudio altogether and fall-back to ALSA for all GNOME based applications, please read section Disabling pulseaudio completely (ALSA fall-back) below.

Packages

GNOME installations include all necessary tools and packages by default. In other enviroments pulseaudio is often dragged in due to dependencies but without the tools to control it. Therefore the following packages may need to be manually installed in order to control the pulseaudio daemon:

  • pavucontrol - PulseAudio Volume Control
  • paprefs - PulseAudio Preferences
  • pulseaudio-utils - PulseAudio utilities
  • padevchooser - PulseAudio Device Chooser
  • paman - PulseAudio Manager
  • alsa-plugins-pulse (-32bit) - Pulseaudio Plug-In for the ALSA Library

Using Pulseaudio as alsa back-end by default

To make all applications that support alsa but not pulseaudio to play sound via pulseaudio you need to install alsa-plugins-pulse (as well as the 32bit package if you are on 64bit) and run the following command to make it default:

sudo setup-pulseaudio --enable

If on the other hand you wish to disable pulseaudio altogether and fall-back to ALSA for all GNOME based applications, please read section Disabling pulseaudio completely (ALSA fall-back) below.

Disabling the OSS module

Certain applications using the OSS audio output, if not correctly configured, could interrupt pulseaudio, such that pulseaudio cannot connect to the output hardware device. This can be disabled by running

rmmod snd-pcm-oss

and then appending blacklist snd-pcm-oss to the file /etc/modprobe.d/50-blacklist.conf . (Taken from ArchLinux wiki.)

Disabling Pulseaudio autospawn

Due to dependencies it is often not possible to uninstall pulseaudio completely. To prevent use of pulseaudio nevertheless autostarting the daemon can be prevented by setting autospawn = no in /etc/pulse/client.conf

Pulseaudio can be disabled using

sudo setup-pulseaudio --disable

This will stop the relevant pulseaudio components including the 'pulseaudio' daemon, and inhibit autospawning as well.


Issues

No sound after installation

There have been cases where the volume is muted by default, and this isn't exposed in the KDE mixer. To fix this, run padevchooser (you may have to install it), click the tray icon, and choose "Volume Control". Check that everything is not muted, including after you start playing sound through an application (the application should show up in the "Playback" tab).

If the sound still isn't working, or the pulseaudio tools aren't working, try adding your user to the "pulse" and "pulse-access" groups (Yast > User and Group Management > [select user] > Edit > Details > Additional Groups). You'll have to log off and back in for this to take effect.

5.1 Sound

There were issues getting 5.1 sound working out of the box, see bug 381686 for more information. Many people have a surround card, but have speakers for just two channels, so PulseAudio can't really default to a surround setup. To enable all the channels, edit /etc/pulse/daemon.conf: uncomment the default-sample-channels line (i.e. remove the semicolon from the beginning of the line) and set the value to 6 if you have a 5.1 setup, or 8 if you have 7.1 setup etc. Or even easier, you can run paprefs and set the speaker setup via the paprefs GUI.

paprefs-speaker-setup.png

Glitches in audio playback

Edit /etc/pulse/daemon.conf: uncomment the default-fragments and default-fragment-size-msec, and change values from the default 4 and 25 to 16 and 21.

Please report back in bug 381686if this works or not for you.

Returning to esound

Remove all pulseaudio* packages and install esound.

Crackling Sound with OpenAL (Games)

The alsa plugin that forces applications to use pulseaudio often causes low sound quality in games that use OpenAL for sound output. Up to and including openSUSE 11.1 openal-soft did not support puseaudio natively. To fix sound in games either get rid of pulseaudio or install a backport from Factory

Starting some applications mutes some others

Some applications (e.g. TeamSpeak) mute other applications when started. This can be fixed by removing or commenting out load-module module-role-cork in /etc/pulse/default.pa.

Disabling pulseaudio completely (ALSA fall-back)

Under openSUSE 11.2, pulseaudio is the audio subsystem of choice for all GNOME based applications. This may cause various coexistence problems, especially in relation to phonon, KDE's sound subsystem that uses ALSA. A very common symptom is that ALSA audio is unable to acquire real-time (or more precisely near-real-time) scheduling, in effect causing delayed and/or clipped sound. Many have found that disabling pulseaudio completely, and thus forcing all GNOME based applications to use ALSA, works much better for them. To accomplish this do the following:

  • Disable pulseaudio:
sudo setup-pulseaudio --disable
  • Remove all pulseaudio packages except libpulse-mainloop-glib0 and libpulse0, as these are required by all GNOME based applications (since they are compiled with pulseaudio by default).
  • Hide the libraries provided by the libpulse-mainloop-glib0 and libpulse0 packages, in order to force GNOME applications to ALSA fall-back. To do this, move them out of the way by issuing the following commands as root (openSUSE 11.2 x86_x64 assumed):
cd /usr/lib64
sudo md HIDDEN
mv *pulse* HIDDEN
ldconfig

Note that if under $HOME/.pulse you have properly setup configuration files (e.g. from when pulseaudio was enabled), the last step above for hiding the pulseaudio libraries may not be required. However, if you accidentally (or intentionally) delete $HOME/.pulse, GNOME based applications will loose audio once again. Regardless of the contents of /etc/asound.conf, moving the libraries out of the way is the only guaranteed method to force fall-back to ALSA.

  • Use an ALSA compatible mixer (e.g. kmix under KDE or alsamixer in a terminal) and make sure all channels of interest are not muted.

Note that this is a work-around, not a definite solution: if either the libpulse-mainloop-glib0 and/or the libpulse0 package is updated, you will need to reissue the above commands to move the pulseaudio libraries out of the way once again, by using the above commands.


Hints and tips

PulseAudio Daemon Fails to Start after Reinstallation

You may see:

E: [pulseaudio] main.c: Daemon startup failed.

Move ~/.config/pulse to ~/.config/pulseold and try to start pulse again. It should come up on the second try.


Dynamic range compression (night mode)

Pulseaudio supports LADSPA plugins, through this a compressor plugin can be used to achieve what is often called "night mode", the goal being to reduce the volume of action sequences (explosions, etc.) in films and other media without diminishing the volume of the quieter dialogue.

Steve Harris' LADSPA plugins are available in openSUSE and include a number of compressors (we'll use the "SC1" compressor in this example), the package is called ladspa-swh-plugins, install that and also an advanced Pulseaudio volume and outputs control panel, such as pavucontrol.

zypper install ladspa-swh-plugins pavucontrol

Then open a text editor as root and edit the file /etc/pulse/default.pa, at the end of the file add the following:

.ifexists module-ladspa-sink.so
.nofail
load-module module-ladspa-sink sink_name=compressor plugin=sc1_1425 label=sc1 control=5,100,-25,8,2.5,0
.fail
.endif

Then save and close the file. Now open a terminal and restart Pulseaudio:

pulseaudio -k
pulseaudio --start

Now open pavucontrol and the SC1 LADSPA plugin should be a selectable output device.

Tweaking the SC1 compressor

The six values after control= represent, in order:

control=Attack time (ms), Release time (ms), Threshold level (dB), Ratio (1:n), Knee radius (dB), Makeup gain (dB)

The settings used in the earlier example give good results in many cases, but one setting you may sometimes want to adjust is the threshold level. It's set to -25 in the example but if the compressor seems to be engaging often for dialogue (which is not what we want - we want it engaging for loud action scenes and such) try -20, or if a track has particularly low volume in general, so the compressor is not engaging for dialogue but action is still too loud, changing the threshold to -30 can improve the results. See the documentation for more details.

Multiple sound devices

The above example makes the SC1 LADSPA plugin available as an output device routed to your default sound device. If you have multiple sound devices and want the option of night mode for them all, first install pulseaudio-utils (if not already installed) and obtain the relevant device identifiers by opening a terminal and running:

pacmd list-sinks | grep name:

You'll get output looking something like this:

name: <alsa_output.pci-0000_00_01.1.hdmi-stereo>
name: <alsa_output.pci-0000_00_14.2.analog-stereo>

Replace the content to be added to the end of /etc/pulse/default.pa shown in the earlier example with the following:

.ifexists module-ladspa-sink.so
.nofail
load-module module-ladspa-sink sink_name=compressor master=alsa_output.pci-0000_00_01.1.hdmi-stereo plugin=sc1_1425 label=sc1 control=5,100,-25,8,2.5,0
load-module module-ladspa-sink sink_name=compressor master=alsa_output.pci-0000_00_14.2.analog-stereo plugin=sc1_1425 label=sc1 control=5,100,-25,8,2.5,0
.fail
.endif

You can see that compared to the earlier example, this example includes master= parameters that are set to the device identifiers as shown in the pacmd output that was retrieved earlier (so don't just arbitrarily copy-paste the above example, you'll have to modify it to use your device identifiers). Then restart Pulseaudio as described earlier and you should have SC1 LADSPA plugin output devices for each of your sound devices.


See also


External links