Thursday Night

Paul Betts’s personal website / blog / what-have-you

Pulseaudio in Ubuntu Feisty – play sound over the network!

This fall, I did a presentation for OSU Open Source club on the PulseAudio sound server, a replacement for ESD with a lot of cool additions and tricks. Unfortunately, I couldn’t get it to work back then, nor could I until I upgraded to Feisty Fawn. However, I finally figured out how to do it.

Why PulseAudio?

But first, some motivation. Why use a sound server these days? Doesn’t ALSA work now? Well, there’s 3 main reasons to rig up PulseAudio:

  • Here’s the main one – PulseAudio can seamlessly play audio on any networked PC, regardless of what computer you’re actually at. What does this mean? Basically, you can hit play on your laptop and have the audio come out of the speakers attached to the desktop.
  • Old programs that use OSS can be rigged to work correctly while having other sounds playing at the same time
  • This one hasn’t been realized yet, but it’s also a very cool feature: audio can be manipulated per-application. While controlling this manually can already be done, it gets really cool when this is automatic based on the class of audio – for example, the music being turned down automatically when a VOIP phone call comes in. Someone worked on this as a Google SoC project, but he didn’t get very far (his implementation was a bit farfetched imo anyways)

How to Pulseaudio’ify

Alright, here’s what you do. First, install some packages:

sudo apt-get install "pulseaudio-*" paman padevchooser paprefs
#####
## If you have Flash Player 9, do this section too
#####
wget "http://www.paulbetts.org/projects/libflashsupport_1.0~2219-1_i386.deb"
sudo dpkg -i libflashsupport_1.0-2219-1_i386.deb

Then, edit the ALSA configuration file using the command: sudo gedit /etc/asound.conf. Fill it in as such:

pcm.pulse {
            type pulse
}

ctl.pulse {
            type pulse
}

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

Some configuration things

Now, go to System->Preferences->Sounds and ensure “Enable Software Mixing” is turned on. Next, we make sure PulseAudio itself is configured correctly by hitting Alt-F2 and typing paprefs. Here’s the dialog with the correct options set:

Make sure that Multicast/RTP is off or else you’ll have problems with skipping and latency, then reboot, or hit Alt-F2 and run ‘pulseaudio’. Next, run Sound And Video->PulseAudio Device Chooser and if you have more than one PC with this setup, you’ll be able to choose which computer to send the audio to. Very cool!

Update: There’s an extra step that was added recently and in the final version of Feisty Fawn: you must add everyone to the pulse-access group. To do this, go to System->Administration->Users and Groups, click on “Manage Groups”, scroll down to “pulse-access”, Properties, then check everyone in the list. Otherwise, you’ll get weird “no-sound” errors and lockups.

Some problems

Unfortunately while you can definitely get this to work, it’s a bit of a hassle and kind of buggy – PulseAudio isn’t very bullet-proof quite yet and you might have to do some haggling. Skype in particular is annoying; it’s usually better to killall pulseaudio before trying to make a Skype call although I did get it working through OSS and padsp.

Update: Fixed busted Flash link

Credits: Most of this howto was taken from The Perfect Setup documentation on the PulseAudio site. The Flash 9 Support file is found at Revolution Linux wiki.

Written by Paul Betts

April 15th, 2007 at 12:05 am

Posted in Linux