PulseAudio

Differences between revisions 21 and 53 (spanning 32 versions)
Revision 21 as of 2008-05-22 09:30:57
Size: 10173
Editor: norton
Comment:
Revision 53 as of 2021-06-16 11:56:57
Size: 3209
Editor: guiverc
Comment: lubuntu 16.04 is EOL/unsupported; modern lubuntu uses pulseaudio so tweak wording (esp. tense)
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= PulseAudio = ||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;">'''Contents'''<<BR>><<TableOfContents>>||
Line 3: Line 3:
[http://www.pulseaudio.org PulseAudio] is a sound server for POSIX and Win32 systems. A sound server is basically a proxy for your sound applications. It allows you to do advanced operations on your sound data as it passes between your application and your hardware. Things like transferring the audio to a different machine, changing the sample format or channel count and mixing several sounds into one are easily achieved using a sound server.

It's a drop in replacement for EsounD. PulseAudio is the standard sound server in Ubuntu Hardy Heron 8.04.

There may be problems with getting sound from Adobe Flash v. 9 and earlier, Wine and Skype when these applications use the ALSA protocol. The sound is supposed to go through the "pulse" plugin in ALSA, that passes it to PulseAudio, where it get mixed with all other sound, and passed on to a audio interface. [[BR]]
The problems seems to be related to the pulse plugin in ALSA, and the special ways these apps uses ALSA.[[BR]]
Currently there are [https://tango.0pointer.de/pipermail/pulseaudio-discuss/2008-May/001749.html three patches for "pulse"] that probably can solve the problems with Wine combined with ALSA/pulse.

== Installation ==

Here's how to install it, as of Dec-08-2007, on Ubuntu Gutsy Gibbon 7.10, with PulseAudio 0.9.6

=== Installing PulseAudio ===

Open a Terminal window.

Type the following:
{{{
sudo apt-get install libasound2-plugins "pulseaudio-*" paman padevchooser paprefs pavucontrol pavumeter
}}}
This will install the ALSA Pulse plugin, the PulseAudio daemons and the PulseAudio tools.
[[http://www.pulseaudio.org|PulseAudio]] is a sound server for POSIX and Win32 systems. A sound server is basically a proxy for your sound applications. It allows you to do advanced operations on your sound data as it passes between your application and your hardware. Things like transferring the audio to a different machine, changing the sample format or channel count and mixing several sounds into one are easily achieved using a sound server.
Line 26: Line 6:
=== ALSA Configuration === = Installation =
Line 28: Line 8:
Now, type the following: Pulseaudio is already installed by default on Ubuntu and flavors.

= PulseAudio Removal =

This is generally a bad idea.

= Using PulseAudio =

For Ubuntu environments that use pulseaudio, Ubuntu has its own custom sound indicator that will allow you to select the preferred device and control the volume of each application. If you would prefer to try pulseaudio's generic control GUI, install the pavucontrol package and launch it with terminal command:
Line 30: Line 18:
gksudo gedit /etc/asound.conf
}}}
This will open /etc/asound.conf in a Text Editor as the root user.

Normally on Ubuntu 7.10, this file will not exist, so we're creating it.

Paste in the following:

{{{
pcm.pulse {
    type pulse
}
ctl.pulse {
    type pulse
}
pcm.!default {
    type pulse
}
ctl.!default {
    type pulse
}
pavucontrol
Line 53: Line 21:
The top two will create new output and input definitions for PulseAudio, and the bottom two will set PulseAudio as the default audio device for programs using the ALSA interface. = Troubleshooting =
Line 55: Line 23:
Save and exit Text Editor. == Resetting User Configuration ==
Line 57: Line 25:
=== Adding Users to the PulseAudio groups === For some reason, pulseaudio's user configuration files can become corrupt(unsynced?) in some way, and deleting them (and forcing fresh ones to be generated) fixes a no sound condition. After using the command below, log out/in.
Line 59: Line 27:
Next we go to System -> Administration -> and click on Users and Groups. === Ubuntu 12.10/Quantal (and earlier) ===
{{{
rm -r ~/.pulse*; pulseaudio -k
}}}
Line 61: Line 32:
Click on Manage Groups, and scroll all the way to the bottom of the list where you will find: === Ubuntu 13.04/Raring (and later) ===
{{{
rm -r ~/.config/pulse; pulseaudio -k
}}}
Line 63: Line 37:
    * pulse
    * pulse-access
    * pulse-rt
== Getting A Verbose Diagnostic Log ==
Line 67: Line 39:
Make sure to highlight each, one at a time, and click Properties. Just put a check next to each user that you want to be able to have access to sound (for example, there's "ted" and "root" and "kamilion" listed, and you only want "kamilion" to have access to sound, that's the one to check, leave the other two blank) This log can aid bug reports. If possible, attach it to any bug report filed against pulseaudio or even to ALSA bug reports where pulseaudio is involved: https://wiki.ubuntu.com/PulseAudio/Log
Line 69: Line 41:
== Configuring PulseAudio == == Using A Lubuntu 16.04 (and older) LiveUSB/CD ==
Line 71: Line 43:
Now, go into Applications -> Sound and Video -> click on PulseAudio Preferences.
    * Checkmark all three options under Network Access. This will allow other computers on your LAN with PulseAudio to access this computer's sound devices.
    * Checkmark Enable Multicast/RTP Receiver. This allows receiving multicast streams from other systems on your LAN.
    * Checkmark Enable Multicast/RTP Sender. This allows sending multicast streams (One source sends packets, all others may receive them simultaneously)
Because Lubuntu 16.04 does not use pulseaudio, it can be useful in determining whether an audio issue is caused by pulseaudio, the ALSA driver, or another program. If the issue still occurs in a Lubuntu environment, pulseaudio is probably not causing it. Note: Modern Lubuntu does use pulseaudio.
Line 76: Line 45:
Leave the other options alone for now, unless you want to loop outgoing streams through the local speakers. == Static, Underruns ==
Line 78: Line 47:
Next go into System -> Preferences -> Sound and make sure that Enable Software Sound Mixing is checked.
Also, under the Sounds Tab, I set devices to Autodetect.

    * Restart the current session with Ctrl + Alt + Backspace to enable pulseaudio (Save any work 1st)

== Using PulseAudio ==

One of the most notable new features of PulseAudio is the ability to change the volume of applications interdependently, this can be accessed to by the program pavucontrol (you may want to add a launcher for it to your panel).

== PulseAudio Removal ==

If you decide you no longer like PulseAudio and would like to disable it:
Remove the added lines to /etc/asound.conf
If /etc/asound.conf did not exist when you installed PulseAudio, you may remove /etc/asound.conf entirely.

After this, you may remove all of the installed PulseAudio packages.

To disable pulseaudio in hardy you need to select alsa for for all options in /system/preferences/sound
https://wiki.ubuntu.com/Audio/PositionReporting
Line 100: Line 51:
== Firefox/Flash and PulseAudio ==

Be Default, libflashplugin (Flash 9 support in Firefox) doesn't work properly with PulseAudio.

'''Update:''' libflashsupport is available in Hardy as a package via the synaptic package manager.

Go to logicalnetworking.net to download the libflashsupport .deb and install it:

{{{
wget http://logicalnetworking.net/other/libflashsupport_1.0~2219-1_i386.deb
}}}

Restart Firefox to enable audio output from flash.

- OR -

Instead I found the files http://pulseaudio.vdbonline.net/flashplugin-nonfree-pulse_0.1~000.tar.gz and http://pulseaudio.vdbonline.net/flashplugin-nonfree-pulse_0.1~000.dsc. --akaihola

'''Note:''' You can download and compile it by doing:

{{{
wget http://pulseaudio.vdbonline.net/flashplugin-nonfree-pulse_0.1~000.tar.gz
tar xvfz flashplugin-nonfree-pulse_0.1~000.tar.gz
cd flashplugin-nonfree-pulse-0.1~000
sudo apt-get install libpulse-dev
make
sudo make install
}}}

'''Note:''' For Hardy64 users:
{{{
http://ubuntuforums.org/showpost.php?p=4350045&postcount=12
}}}

Line 137: Line 53:
If you have firestarter installed, it *WILL* stop PulseAudio from properly communicating over Zeroconf/Avahi's port 5353. If you have firestarter firewall installed, it *WILL* stop PulseAudio from properly communicating over Zeroconf/Avahi's port 5353.
Line 153: Line 69:
= Recording example using PulseAudio and Audacity = == Programs Using OpenSound/OSS output ==
Line 155: Line 71:
This recording is equivalent to using the 'stereo mix' source setting in Windows to record the sounds going through the computer i.e. it should be able to record anything that the computer can output to speakers/headphones. Note that recording from some sources e.g. some web-based Flash audio sources, may be illegal in some countries; it is your responsibility to ensure that you abide by all relevant laws.

This example worked on Hardy 8.04. For the initial configuration, the above steps were followed except that:

    * Nothing was put into /etc/asound.conf
    * libflash-mozplugin was installed as well as libflashsupport.
    * The three changes listed above under 'Applications -> Sound and Video -> click on PulseAudio Preferences' weren't made. (Note also that these options are now under Applications -> Sound and Video -> PulseAudio Device Chooser, which launches a panel icon 'PulseAudio Applet', and then they are under Configure Local Sound Server, but they weren't changed in any case).

Once Audacity, PulseAudio and a sound source e.g. Totem music player or a web-based sound source are working, take the following steps to record.

    * Open up 'Applications -> Sound and Video -> PulseAudio Volume Control'.
    * Assuming you started with no applications playing anything, the Playback tab will be blank
    * On the Output Devices tab, right click on the volume level for the sound output that you actually listen with e.g. USB audio headphones might be 'ALSA PCM on front:1 (USB Audio) via DMA'. Select Default in the little box that pops up.
    * On the Input Devices tab, on the Show options at the bottom right, choose Monitors (or All). Right click on the monitor for the sound output that you listen to i.e. the monitor of the same device that you selected on the Output tab e.g. 'Monitor Source of ALSA PCM on front:1 (USB Audio) via DMA'. Select Default in the little box that pops up.
    * Open up the source of the sound, e.g. Totem music player or a web page that plays audio. Once the sound starts, pause it and go back to the start if you can.
    * Go back to the Playback tab of the PulseAudio Volume Control. It should be showing the sound stream. If you right-click on the volume bar of the stream and hover the mouse over the 'Move Stream...' words, you can verify that the sound is pointing towards the same place you selected in Output Devices above.
    * Open up audacity but use the command 'padsp audacity' instead of just 'audacity'. This will make the OSS source within audacity actually come from PulseAudio. You can permanently change the command for the menu item if you wish using System -> Preferences -> Main Menu.
    * Under Edit, Preferences in Audacity, in the 'Audio I/O' section, de-select the two checkboxes under Playthrough, set the recording device to 'OSS :/dev/dsp' and the channels to '2 (Stereo)'. Set the playback device to 'OSS :/dev/dsp' too. Click on Ok to close the dialog.
    * Click on the record button in audacity and start the sound off again from the source. When you're done, stop the recording in audacity, remove any bits of the sound that you don't want e.g. leading and trailing blank sounds, and export as an mp3 file.


= Credits =

Kamilion initially wrote this wikipage on Dec-08-2007 using information found through the following sources:

Ghost|BTFH supplied the initial Ubuntu howto for older Ubuntu versions and the libflashplugin fix in his blog, here:
http://ghost.thewatch.org/2007/05/pulseaudio-in-ubuntu.html

! ! Note ! - As of 2008-02-10 the URL mentioned above, ghost.thewatch.org/2007/05/pulseaudio-in-ubuntu does not exist.

varunus supplied the information on how to make Avahi work with Firestarter here:
http://ubuntuforums.org/showthread.php?t=164193

akaihola added the note about broken Flash fix URL on 2008-02-03.

jerickson (Logical Networking Solutions) modified the libflashsupport .deb URL to point to a valid location on 2008-03-24.

twright added information on compiling flashplugin-nonfree-pulse and using pavucontrol
You may run into applications that use OSS output (programs looking for /dev/dsp). Ubuntu no longer supports OSS natively, and you should try to switch the program's audio output to something better supported, like ALSA or esound/esd (which pulse emulates very well). If that's not possible, you can run the program using OSS emulation:
{{{
padsp <command_to_start_program>
}}}

PulseAudio is a sound server for POSIX and Win32 systems. A sound server is basically a proxy for your sound applications. It allows you to do advanced operations on your sound data as it passes between your application and your hardware. Things like transferring the audio to a different machine, changing the sample format or channel count and mixing several sounds into one are easily achieved using a sound server.

Installation

Pulseaudio is already installed by default on Ubuntu and flavors.

PulseAudio Removal

This is generally a bad idea.

Using PulseAudio

For Ubuntu environments that use pulseaudio, Ubuntu has its own custom sound indicator that will allow you to select the preferred device and control the volume of each application. If you would prefer to try pulseaudio's generic control GUI, install the pavucontrol package and launch it with terminal command:

pavucontrol

Troubleshooting

Resetting User Configuration

For some reason, pulseaudio's user configuration files can become corrupt(unsynced?) in some way, and deleting them (and forcing fresh ones to be generated) fixes a no sound condition. After using the command below, log out/in.

Ubuntu 12.10/Quantal (and earlier)

rm -r ~/.pulse*; pulseaudio -k

Ubuntu 13.04/Raring (and later)

rm -r ~/.config/pulse; pulseaudio -k

Getting A Verbose Diagnostic Log

This log can aid bug reports. If possible, attach it to any bug report filed against pulseaudio or even to ALSA bug reports where pulseaudio is involved: https://wiki.ubuntu.com/PulseAudio/Log

Using A Lubuntu 16.04 (and older) LiveUSB/CD

Because Lubuntu 16.04 does not use pulseaudio, it can be useful in determining whether an audio issue is caused by pulseaudio, the ALSA driver, or another program. If the issue still occurs in a Lubuntu environment, pulseaudio is probably not causing it. Note: Modern Lubuntu does use pulseaudio.

Static, Underruns

https://wiki.ubuntu.com/Audio/PositionReporting

Known Issues

Firestarter & Avahi

If you have firestarter firewall installed, it *WILL* stop PulseAudio from properly communicating over Zeroconf/Avahi's port 5353.

How to Fix:

gksudo gedit /etc/firestarter/user-pre

In the file, add the following lines:

$IPT -A INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
$IPT -A OUTPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT

Then, save and close the file, and then type:

/etc/init.d/avahi-daemon restart

Programs Using OpenSound/OSS output

You may run into applications that use OSS output (programs looking for /dev/dsp). Ubuntu no longer supports OSS natively, and you should try to switch the program's audio output to something better supported, like ALSA or esound/esd (which pulse emulates very well). If that's not possible, you can run the program using OSS emulation:

padsp <command_to_start_program>

PulseAudio (last edited 2021-06-16 11:56:57 by guiverc)