PulseAudio_Old

**NOTE: THIS PAGE IS THE OLD PULSEAUDIO WIKI AND MUCH OF THE INFORMATION IS IRRELEVANT TO CURRENTLY SUPPORTED UBUNTU RELEASES***. The page continues to exist for reference reasons (though it may be deleted entirely if it causes confusion). The new page is found here: https://wiki.ubuntu.com/PulseAudio

Tag/tag.png

Unsupported Version
This article applies to an unsupported version of Ubuntu. More info...

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. These problems should not occur in Flash v. 10 and later.
The problems seems to be related to the pulse plugin in ALSA, and the special ways these apps uses ALSA.
Currently there are three patches for "pulse" that probably can solve the problems with Wine combined with ALSA/pulse.

Installation

Warning /!\ This section only applies to old, unsupported versions of Ubuntu. Ubuntu 8.04 and higher installs PulseAudio by default and no extra configuration is needed.

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.

ALSA Configuration

Warning /!\ This section only applies to old, unsupported versions of Ubuntu. Ubuntu 8.04 and higher installs PulseAudio by default and no extra configuration is needed.

Now, type the following:

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
}

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.

Save and exit Text Editor.

Adding Users to the PulseAudio groups

Next we go to System -> Administration -> and click on Users and Groups.

Click on Manage Groups, and scroll all the way to the bottom of the list where you will find:

  • pulse-access
  • pulse-rt

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.

Note: The "pulse" group is for pulseaudio internal use, and normal users should not be added to this group.

Configuring PulseAudio

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)

Leave the other options alone for now, unless you want to loop outgoing streams through the local speakers.

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

P.S. In Xubuntu 10.04 it is enough, if you issue command

sudo apt-get autoremove pulseaudio

in terminal and then restart Xubuntu.

Known Issues

Firefox/Flash and PulseAudio

Kubuntu Maverick and Flash 10

Officially pulseaudio was only added to this release of Kubuntu. If you have played around with pulseaudio on Kubuntu in previous releases and then upgraded to Maverick, you might have a problem with flasplayer being unable to play simultaneously with other programs (and vice versa). This might be caused by incorrect content in /etc/asound.conf file (like this, for example). Make sure it's content is as described posted above (see instructions for 7.10), and if it was not like that, restart pulseaudio and all the audio applications running (including kmix). Sound and simultaneous operation might be back.

Jaunty and Flash 10

In Jaunty and later, Flash 10 should work out of the box with PulseAudio. If you have no sound in Flash, and the PulseAudio volume control is not showing a Firefox player when playing sound in Flash in Firefox, you may need to ensure that PulseAudio is the default sound card, as follows:

Setting PulseAudio as the default sound card

To set up PulseAudio as the default sound card if it is not, install asound-gtk:

sudo apt-get install asound-gtk

Then go to System->Preferences->Default Sound Card and ensure that PulseAudio is selected, and restart your browser.

Hardy and Flash 9

By default, the Firefox Flash 9 plugin doesn't work properly with PulseAudio. In Hardy, Flash support can be enabled by installing the package libflashsupport:

sudo apt-get install libflashsupport

In previous Ubuntu releases, Flash support can be enabled in two ways: by downloading and installing a .deb from logicalnetworking.net or by building a patched version of the Flash plugin from source. (See detailed instructions below.).

If you experience problems with audio synchronization after installation, you may need to edit the file /etc/firefox/firefoxrc. The line referencing FIREFOX_DSP should read

FIREFOX_DSP="padsp"

Restart Firefox for the change to take effect.

Note: For Hardy AMD64 users:

http://ubuntuforums.org/showpost.php?p=4350045&postcount=12

Installing the Flash support package

wget http://logicalnetworking.net/other/libflashsupport_1.0~2219-1_i386.deb
sudo dpkg -i libflashsupport_1.0~2219-1_i386.deb

Note: For AMD64 users, there is now a plugin for Flash player 10 from Adobe for 64-bit Linux systems. This invalidates other package installations for flash on this page. Get it here: http://labs.adobe.com/downloads/flashplayer10.html

Restart Firefox to enable simultaneous audio output from flash and other sources (rhythmbox, totem, etc).

Building the Flash plugin from source

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

PulseAudio does not start automatically

If PulseAudio does not start at login time, you can try to set the gconf value of /desktop/gnome/sound/enable_esd to true.

Firestarter & Avahi

If you have firestarter 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

Recording example using PulseAudio and Audacity

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.

Intrepid 8.10

  • 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.

Jaunty Jackalope 9.04

  • There's no longer any need to start Audacity with padsp, so remove this again from the Main Menu using System -> Preferences -> Main Menu if you had changed it in 8.10 and then upgraded to 9.04 automatically. Otherwise there should be no need to change the start-up command for Audacity.

  • Open up 'Applications -> Sound and Video -> PulseAudio Volume Control'.

  • 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. Right click, choose Move Stream and point it to the stream that you listen on e.g. 'USB Headphone set'.

  • Open up Audacity and select 'Edit -> Preferences'. In the 'Audio I/O' section, de-select the two checkboxes under Playthrough. Under Playback, choose Device: ALSA: pulse. Under Recording choose Device: ALSA: pulse and Channels: 2 (Stereo). Click Ok to save the changes, then close down Audacity and open it up again.

  • In Audacity, click on Record, and then Pause.
  • Go back to the Pulse Volume control and look for the new entry for Audacity on the Recording tab. It will probably be called 'ALSA plug-in [audacity]: ALSA capture'. Right-click on the stream, choose Move Stream and then select the Monitor for the device that you listen to e.g. 'Monitor for USB Headphone set'.
  • Release the pause in Audacity and start playing the audio. When the recording has finished, press stop in Audacity and remove and superfluous sections at the start and end of the track using Audacity's editing features. Then export as an MP3 file.

Lucid Lynx 10.04 and Maverick Meerkat 10.10

These instructions describe how to record any audio stream that are piped through to your sound system (e.g., external speakers, headphones) using Audacity. Any KDE recording software should work. For the purposes of this example, the audio (voice, music, or soundtrack) player will be Sonic Visualiser but could be any sound source (e.g., MPlayer, VLC, Firefox Flash video, MIDI device). The "PulseAudio Volume Control" program is not installed by default, but can be installed by typing the command sudo apt-get install pavucontrol from a terminal window, or using the System Settings' Software Management to install the pavucontrol package.

  1. Click the K menu.
  2. Click Multimedia » PulseAudio Volume Control.

  3. Start Audacity.

  4. Start Sonic Visualiser.

  5. Open audio in Sonic Visualiser. (That is, find and prepare to play the sound that you want recorded.)

  6. Click Play on Sonic Visualiser.
  7. Click the Playback tab in PulseAudio Volume Control to see the Sonic Visualiser stream.

  8. Click Rewind in Sonic Visualiser.

  9. Switch to Audacity.

  10. Click Edit » Preferences.

  11. Click Devices (on the left).

  12. Set Playback to pulse.

  13. Set Recording to pulse.

  14. Set Channels to (Stereo).

  15. Click OK to close the dialog.

  16. Click the Record button.
  17. Switch to PulseAudio Volume Control.

  18. Click the Recording tab.

  19. Set Show to All Streams.

  20. Set ALSA Capture from to Monitor of Internal Audio Analog Stereo.

  21. Click Output Devices.

  22. Ensure Port is set to Analog Output.

  23. Switch to Sonic Visualiser.

  24. Click the Rewind button.
  25. Click Play.

The audio playing in Sonic Visualiser should be recorded in Audacity.

KDE PulseAudio Integration

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

CategoryCleanup CategoryCleanup

PulseAudio_Old (last edited 2013-02-15 21:43:45 by c-174-55-144-102)