Search:  
Gentoo Wiki

PulseAudio


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Introduction

The aim of the article is to guide you in installing and configuring PulseAudioServer. For more Information about the Pulse Audio Server check the Pulse Wiki.

Installing

Before emerge

Packages

PulseAudio consists of 6 packages: pulseaudio,paprefs,pavumeter,padevchooser,paman and pavucontrol. I recommend all of them but I think you could leave some out if you're really up to.

Note that everything but pulseaudio are X-GUI apps, so you won't need them unless you run X.

USE Flags

To gauge what USE-flags pulseaudio carries, run,

$ emerge -pv pulseaudio paprefs pavucontrol paman padevchooser pavumeter

For instance if you need jack support, enable the jack USE-flag. If you feel uncertain on USE-flag handling, consult the USE-flags FAQ or the official Gentoo USE-flag documentation.

Glib

From flameeyes' Blog

[..]since last night there’s PulseAudio 0.9.9 in tree. This version is just a security fix over 0.9.8, but the -r1 version in ~arch now has a glib USE flag, enabled by default, that allows you to remove glib support, for instance for embedded systems. At the moment glib is used only by the PulseAudio management software (paman, pavumeter, pavucontrol, paprefs padevchooser); so if you’re not using those, you might disable the glib USE flag mostly safely, for now.

Emerge

Emerge pulseaudio by running

# emerge -av pulseaudio paprefs pavucontrol paman padevchooser pavumeter

Configuration

Configuration Files

PulseAudio has three configuration files.

Running eselect

Run eselect so that esound applications use PulseAudio

eselect esd list
eselect esd set <number of PulseAudio>

Pulse Audio Server

Before using PulseAudio, you must launch the PulseAudio server:

pulseaudio

System-wide Instance: Start at Boot

Alternatively, You can use a system-wide instance for the PulseAudio server, but this is not recommended unless you are running a thin client.

You may want to add pulseaudio to the default Runlevel

# rc-update add pulseaudio default

And add your user to pulse and pulse-access groups

# gpasswd -a USER pulse
# gpasswd -a USER pulse-access

Setup as a network server

If you want to setup PulseAudio as a network sound server and try to run it via the init.d-script with the unchanged default configs, you may get these messages:

May  2 19:44:25 [pulseaudio] pid.c: Stale PID file, overwriting.
May  2 19:44:25 [pulseaudio] main.c: setrlimit(RLIMIT_NICE, (31, 31)) failed: Operation not permitted
May  2 19:44:25 [pulseaudio] main.c: setrlimit(RLIMIT_RTPRIO, (9, 9)) failed: Operation not permitted
May  2 19:44:25 [pulseaudio] x11wrap.c: XOpenDisplay() failed
May  2 19:44:25 [pulseaudio] module.c: Failed to load  module "module-x11-publish" (argument: ""): initialization failed.
May  2 19:44:25 [pulseaudio] main.c: Module load failed.
May  2 19:44:25 [pulseaudio] main.c: failed to initialize daemon.
May  2 19:44:25 [pulseaudio] main.c: daemon startup failed.

The solution is to edit /etc/pulse/default.pa and to comment out the line:

load-module module-x11-publish

You may also comment out this line for a similar reason:

load-module module-gconf

For an easy configuration for listening on a TCP port (4713 by default), add this line to the default.pa:

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/16

For the output of the sound, if you use ALSA and have only one card, this line (again in default.pa) should be fine:

load-module module-alsa-sink

On the client, add the pulseaudio USE-flag and reemerge the packages with this support (for example xine-lib). This will also emerge pulseaudio for you as a dependency. Then edit the file /etc/pulse/client.conf and add this:

default-server = tcp:yourserver:4713

After this, I was able to select the pulseaudio-output in the xine Engine in Amarok and to play my music on my PulseAudio server!

Other applications

ALSA

If a program supports PulseAudio directly, generally, you would use PulseAudio directly. If a program only supports ALSA, then you can use PulseAudio through ALSA.

Adding PulseAudio support to ALSA allows programs which use ALSA to use PulseAudio through ALSA.

For alsa support, emerge media-plugins/alsa-plugins:

emerge -av media-plugins/alsa-plugins

Add this to your .asoundrc:

pcm.pulse {
    type pulse
}

ctl.pulse {
    type pulse
}

If you need a test sound file, emerge gnome-extra/gnome-audio which only has sound files:

emerge -av gnome-extra/gnome-audio

Test with:

aplay -Dpulse /usr/share/sounds/generic.wav

If you want PulseAudio to be the default device for ALSA, add this to your .asoundrc:

pcm.!default {
    type pulse
}

ctl.!default {
    type pulse
}

gStreamer

Emerge gst-plugins-pulse for gstreamer support:

emerge -av media-plugins/gst-plugins-pulse

Run gstreamer-properties and under the Audio tab set default Input and default Output plugin to pulseaudio

$ gstreamer-properties

Known Problems

Flash

If you want to have Flash support on your system you will have to install libflashsupport.

$ emerge -av libflashsupport

mDNSResponder

mDNSResponder, if emerged, will block with avahi if you compile with the flags recommended above for full functionality.

$ emerge mDNSResponder --unmerge 

...before emerging pulseaudio with the flags given above if you don't need it and it's installed.

pbbuttonsd

pbbuttonsd needs access to PulseAudio to adjust the sound volume. So you have to add the user that is running pbbuttonsd (probably root) to the PulseAudio groups.

# gpasswd -a root pulse
# gpasswd -a root pulse-access

System sounds do not play (GNOME)

If you want to hear system sounds in system-wide instance you need change startup script /etc/init.d/pulseaudio. In function start() add this text after start-stop-daemon --start --exec /usr/bin/pulseaudio -- ${PA_ALL_OPTS}

       if [ -e /var/run/pulse/.esd_auth ]; then
           chown pulse:pulse-access /var/run/pulse/.esd_auth
           chmod 640 /var/run/pulse/.esd_auth
       fi

Links

Retrieved from "http://www.gentoo-wiki.info/PulseAudio"

Last modified: Fri, 10 Oct 2008 03:00:00 +0000 Hits: 16,232