Difference between revisions of "PulseAudio"

From ArchWiki
Jump to navigation Jump to search
(Configuration of adobe flash plugin for PulseAudio)
m
Line 1: Line 1:
 +
[[Category:Sound (English)]]
 +
 +
= Introduction =
 
PulseAudio is a sound server for POSIX and Win32 systems. It allows to have multiple programs playing sound at one machine and even more advanced features.
 
PulseAudio is a sound server for POSIX and Win32 systems. It allows to have multiple programs playing sound at one machine and even more advanced features.
  

Revision as of 22:45, 12 September 2007


Introduction

PulseAudio is a sound server for POSIX and Win32 systems. It allows to have multiple programs playing sound at one machine and even more advanced features.

This article focus on having multiple programs playing sound at the same time on one machine.

Install

All packages are from the community repository so you need to have it enabled

pacman -Sy pulseaudio 

Optionally you can install some GTK front-ends for PulseAudio (recommended)

pacman -Sy padevchooser paman paprefs pavucontrol pavucontrol

For the applications who doesn't support PulseAudio and support ALSA it's recommend to install PulseAudio plugin for alsalibs. This plugin is available in the alsa-plugins package. (Note: When I write this, 20 of August of 2007, the package has not the PulseAudio plugin on it for a unknown reason to me but it's on the PKGBLUID of the same on the Arch Linux CVS)

pacman -Sy alsa-plugins

Configuration

First you need to add "pulseaudio" daemon in /etc/rc.conf example:

DAEMONS=(syslog-ng ipw3945d network netfs crond fam pulseaudio hal)

Then you need to add the user(s) to the pulse-access group, even for root (if you want to have sound as root).

gpasswd -d <user> pulse-access

Now you just need to set all the applications that you use to work with pulse, possibly through a plugin.

Configuration of ALSA for PulseAudio plugin

It's recommend that since most of applications use ALSA that you configure it so it works with PulseAudio also. This is done through the PulseAudio plugin for alsalibs (PulseAudio plugin is available through the alsa-plugins package). In order to ALSA use the PulseAudio we need to edit the /etc/asound.conf (recommended) or ~/.asoundrc to have this lines:

pcm.pulse {
    type pulse
}
ctl.pulse {
    type pulse
}

pulse in pcm.pulse and ctl.pulse it's just a name, you can change it but it would change the next steps.

If you want that by default that ASLSA use PulseAudio plugin you change also add this to /etc/asound.conf or ~/.asoundrc

pcm.!default {
    type pulse
}
ctl.!default {
    type pulse
}

If you selected pulse to be your default device you need to specify the hardware device to PulseAudio in /etc/pulse/default.pa example:

load-module module-alsa-sink device=hw:0
load-module module-alsa-source device=hw:0


If haven't made the PulseAudio as ALSA default, in the applications that you use you need to change the ALSA device to "pulse" so it works.

Configuration of adobe flash plugin for PulseAudio

The default Adobe flash plugin for Mozilla doesn't work well with the PulseAudio plugin for ALSA so you won't get no sound but there is a way make the flash plugin work with PulseAudio even if you end up with a little delay. This is done through the libflashsupport and there is a package for it on the AUR. Link : [1] This lib should auto detect the PulseAudio and work but it doesn't so we need to make this library to use PulseAudio. We can do this through the enviromment variable FLASH_FORCE_PULSEAUDIO and in order to all users have this working without any trouble we can create the variable at the login of a user. We do this with creating script, the /etc/profile.d/libflashsupport.sh file:

export FLASH_FORCE_PULSEAUDIO="1"
# export FLASH_AUDIODEBUG="1" If you want to see debug from the flash audio
# export FLASH_PULSEDEBUG="1" If you want to know de delay from the sound

In order to have the proper permissions

chmod 755 /etc/profile.d/libflashsupport.sh

or you can simply add

export FLASH_FORCE_PULSEAUDIO="1"

to the /etc/profile file

Permanently change the daemon priority

Take a look at "schedtoold" [2]

See also

Allow multiple programs to play sound at once

External Links

http://www.pulseaudio.org/wiki/PerfectSetup - A good guide to make your configuration perfect
http://www.alsa-project.org/main/index.php/Asoundrc - Alsa wiki on .asoundrc
http://www.pulseaudio.org/ - PulseAudio official site