PulseAudio (Italiano)

From ArchWiki
Revision as of 20:59, 24 May 2008 by Nss (Talk | contribs) (New page: Category:Sound (English) Category:Audio/Video (English) {{i18n_links_start}} {{i18n_entry|English|PulseAudio}} {{i18n_entry|Italiano|PulseAudio (Italiano)}} {{i18n_links_end}} = ...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n links end


PulseAudio è un sound server per sistemi POSIX e Win32. Esso permette di avere più programmi che riproducono suoni sulla stessa macchina e molte altre funzioni avanzate. PulseAudio è un'alternativa al demone sonoro esd.

Attenzione PulseAudio NON è un'alternativa per aRts. Se si sta usando KDE, non è per ora possibile usare PulseAudio.

Questo articolo riguarda le funzioni di base di PulseAudio.


Tutti i pacchetti si trovano nel repository community, quindi è necessario averlo abilitato. Quindi, per installare pulseaudio utilizziamo:

pacman -Sy pulseaudio 

Si possono inoltre installare alcune interfaccie GTK per Pulseaudio (raccomandato):

pacman -Sy padevchooser paman paprefs pavucontrol

Per le applicazioni che non supportano PulseAudio e supportano ALSA non è raccomandato installare il plugin di PulseAudio per alsalibs. Il plugin si trova nel pacchetto alsa-plugins.

pacman -Sy alsa-plugins

Rimpiazziamo ESD (EsounD) (IN TRADUZIONE)

ln -sf /usr/bin/esdcompat /usr/bin/esd

Pulseaudio usa di default una differente socket ( Pulseaudio uses by default a different socket (/tmp/.esd-xxxx) as the stock to prevent different users to access the same socket. If you want gnome start esd (esdcompat actually) automatically as a user you should edit the file /etc/pulse/default.pa to make it use the default socket as expected by most gnome apps:

load-module module-esound-protocol-unix socket=/tmp/.esd/socket 

This works only if you are the only user of the computer however, as soon as a second user starts gnome on the same computer problems are likely to appear. To have a more general solution for the problem start esdcompat on a server basis.


First you need to add the "pulseaudio" daemon to /etc/rc.conf. Example:

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

To use the PulseAudio Device Chooser (padevchooser), you might also need to add the 'avahi-daemon' to this list.

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 -a <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 the ALSA PulseAudio plugin

It's recommended to configure ALSA for PulseAudio, since most applications use ALSA. This is done through the PulseAudio plugin for alsalibs (the ALSA PulseAudio plugin is available through the alsa-plugins package). In order for ALSA to use PulseAudio we need to edit /etc/asound.conf (recommended) or ~/.asoundrc to have these lines:

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

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

If you want ALSA to use PulseAudio by default you should 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 either 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

or you can use automatic detection using hal with:

load-module module-hal-detect

If you haven't configured PulseAudio as the ALSA default, you need to change the ALSA device to "pulse" in the applications that you use to make it work.

Multiple PulseAudio ALSA devices

If you want to use multiple sound cards or multiple virtual PCMs of your sound card (for example, to separate front and rear outputs), you'll need to tell PulseAudio to use multiple ALSA sinks:

load-module module-alsa-sink device=front
load-module module-alsa-sink device=rear

If you want the client to have separate Pulse/ALSA outputs for each device, edit /etc/asound.conf or ~/.asoundrc:

pcm.pulsefront {
    type pulse
    device front
pcm.pulserear {
    type pulse
    device rear

And specify the appropriate ctl elements:

ctl.pulsefront {
    type pulse
    device front
ctl.pulserear {
    type pulse
    device rear

Configuration of the Adobe Flash plugin for PulseAudio

The default Adobe Flash plugin for Mozilla doesn't work well with the PulseAudio plugin for ALSA so you'll get no sound but there is a way to make the Flash plugin work with PulseAudio even though you might end up with a little delay. This is done through libflashsupport and there is a package for it on the AUR. Link : [1]

This lib version should correctly auto detect PulseAudio and work, if it doesn't we can force it to use PulseAudio. We can do this through the environment variable FLASH_FORCE_PULSEAUDIO and in order for all users to have this working without any trouble we can create the variable at the login of a user. We do this by editing the script /etc/profile.d/libflashsupport.sh (create it if it doesn't exist):

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

If your PulseAudio daemon is running remotely Flash cannot autodetect it. Therefore, you'll need to specify the PULSE_SERVER environment variable:


replacing the IP address with that of your server, of course.

Configuration of SDL for PulseAudio

Since SDL version 1.2.12, SDL has native pulseaudio support.

export SDL_AUDIODRIVER="pulse"

to use it. Other environment variables to configure: set PASERVER to the host of the PulseAudio server and set PADEVICE to the device used on the server. (the "pulse" driver has no support, yet, for reading your pulseaudio configuration, it seems.).

Or, if this driver does not work for you or if you are using an older version of SDL,

export SDL_AUDIODRIVER="esd"

might do the trick.

Note: You may need to use the ABS to compile SDL with pulseaudio support. Until the quality of the driver is fixed upstream, please use the patch located here: SDL PulseAudio Patch. It should fix most if not all the sound issues you may be having.

Configuration of GStreamer for PulseAudio

To make GStreamer use PulseAudio, you'll need to install the gstreamer0.10-pulse package and set /system/gstreamer/0.10/default/audiosink and /system/gstreamer/0.10/default/audiosrc to the desired values:

 pacman -Sy gstreamer0.10-pulse
 gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosink pulsesink
 gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosrc pulsesrc

Alternately, you could use the gstreamer-properties application to set the gconf entries:


Configuration of OpenAL for PulseAudio

Games that uses OpenAL can use PulseAudio directly writing this line in ~/.openalrc:

(define devices '(esd))

Configuration of libao for PulseAudio

pacman -Sy libao-pulse

Edit /etc/libao.conf, add:


Using OSS apps with PulseAudio wrapper

If you have a program that uses OSS you can make it work with PulseAudio by starting it with padsp:

padsp OSSprogram

If you prefer you can rename the program OSSprogram-real and replace it with a script like this:

if test -x /usr/bin/padsp ; then
    exec /usr/bin/padsp /usr/bin/OSSprogram-real "$@"
    exec /usr/bin/OSSprogram "$@"

PulseAudio over network

One of PulseAudio's magnificent features is the possibility to stream audio from clients over TCP to the server running the PulseAudio daemon, allowing sound to be streamed through your LAN. To accomplish this, one needs to enable module-native-protocol-tcp, and copy the pulse-cookie to the clients. To enable the TCP module, add this to /etc/pulse/default.pa:

load-module  module-native-protocol-tcp

If you're running a system-wide PulseAudio instance, which makes sense for networked audio, the cookie is located in /var/run/pulse/.pulse-cookie. This cookie needs to be sent to the client and placed somewhere the pulse-access group can read (and with permissions so only they can read it).

root@server ~ $ scp /var/run/pulse/.pulse-cookie client:/etc/pulse-cookie
root@client ~ $ chown pulse:pulse-access /etc/pulse-cookie
root@client ~ $ chmod 640 /etc/pulse-cookie

The pulse client needs to know where to look for the cookie. /etc/pulse/client.conf:

### Cookie file
cookie-file = /etc/pulse-cookie

Then the client needs to be configured to connect to the specified server. /etc/pulse/client.conf:

## The default server to connect to
default-server =

That's it!


If PulseAudio fails to start and the messages

 x11wrap.c: XOpenDisplay() failed
 module.c: Failed to load  module "module-x11-publish" (argument: ""): initialization failed.
 main.c: Module load failed.
 main.c: failed to initialize daemon.

appear in your logs, you need to disable module-x11-publish in /etc/pulse/default.pa:

 #load-module module-x11-publish

If PulseAudio fails to start as a daemon and the message

 E: main.c: daemon startup failed.

appear, you may need to disable the line in /etc/pulse/default.pa that reads


Simply add a "#" as a comment in front of that line.


According to the PulseAudio.org Wiki, Audacity doesn't currently support PulseAudio. Therefore they suggest killing pulseaudio before using it.

PulseAudio Device Chooser (padevchooser)

If you can't launch the PulseAudio Device Chooser, first (re)start the Avahi daemon as follows:

 sudo /etc/rc.d/avahi-daemon restart

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
http://mpd.wikia.com/wiki/PulseAudio#Version_0.12.0_and_later - Configuring MPD for PulseAudio