CleanupAudioJumble

Revision 8 as of 2006-11-11 00:35:52

Clear message

Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another knowledgeable person before making changes.

Summary

The idea is to make PulseAudio the default sound system on Ubuntu, replacing the Esound Sound Daemon (esd) and ALSA dmix. PulseAudio is a drop-in replacement for Esound, but adds new features, opening it for many entirely new areas.

Rationale

Apple managed to standardize on a single powerful sound system (CoreAudio) for MacOSX which makes almost all users happy, ranging from normal day-to-day desktop users to gamers, to professional audio people. We should be able to provide the same on Linux. PulseAudio can currently provide the functionality at least partially, with the only notable exception being pro audio. PulseAudio is a modular sound server, kind of an "application server" for audio. Beyond the obvious sound mixing functionality it offers advanced audio features like "desktop bling", hot-plug support, transparent network audio, hot moving of playback streams between audio devices, seperate volume adjustments for all playback or record streams, very low latency, very precise latency estimation (even over the network), a modern zero-copy memory management , a wide range of extension modules, availability for many operating system, compatibility with 90% of all currently available audio applications for Linux in one way or another.

In the future it is expected that PulseAudio will extend to professional audio stuff, entering JACK's current application area. This however is not relevant for the implementation of this spec, at least at this time.

Use cases

  • L. wants to play a video and a background music track at the same time, without any special setup and hassles but with lip-sync audio.
  • L. wants to transparently playback local audio on a remote machine.
  • L. wants to move the currently played back stream from the internal soundcard of his laptop to the USB headset he just plugged in, without any interruption in playback and with only minor clicking on the UI.
  • L. wants that the operation described in the previous item is done automatically by the sound system if he plugs in his USB headset.
  • L. wants to control the volume for each playback stream separately, selecting the right mixer track based on the song name.
  • L. wants to merge his two stereo sound cards into a single 4 channel surround sound card.
  • L. wants that his MP3 music is always played at half the volume but Ekiga's voice stream at the full volume level.
  • L. wants to browse for the audio devices on the network and use them much the same way he already uses the shared network printers.
  • L. wants to move the local audio stream which is played by his bedroom's computer without interruption to the computer in the kitchen.
  • L. wants to multicast audio from his laptop to all machines in his network.
  • L. wants mixed audio but still low enough latencies for voip.
  • L. wants proper audio on his LTSP thin clients.

Scope

This specification changes the default sound daemon for Ubuntu. The same is immediately applicable to Xubuntu, if desired.

Design

Mode of operation

In order to provide the highest possible audio quality, use all features like hal support and dynamic stream handling, and not opening any potential attack vector, the upstream recommended mode of operation is to have a permanent pulse daemon running as the user, without automatic module unloading, and maintaining a permanent connection to the sound card hardware device. However, this mode breaks the following use cases:

  1. Two users are logged in at the same time, and either of them wants to use the sound card.
  2. Commercial and legacy applications often use OSS for sound output, which wants exclusive sound card access.

While 2. can be circumvented by calling the application with existing wrappers which redirect /dev/dsp access to the Pulse emulation, we recognize that we cannot enforce this at the moment. Thus the alsa sink driver needs to be modified to release the sound card file handle when it's inactive for 5 seconds.

Compatibility

PulseAudio emulates the OSS, ALSA, and esound API (amongst others), so that existing applications can be moved to Pulse without much effort. Just for the record, this emulation has nothing to do with ALSA's OSS emulation, Pulse will work even if these modules are loaded (but not used).

GUI

PulseAudio offers three different graphical user interfaces for controlling audio (see a [http://0pointer.de/public/pulse-screenshot.png screenshot]:

  1. pulseaudio volume control: Controls the volume of sinks, sources, and streams, and allows the user to move streams between sinks.
  2. pulseaudio preferences: configure network related services including multicast
  3. panel applet: notify about changes of sound hardware, choose default device, call the other pulseaudio tools.

The volume control and preferences applications are sufficient for all the use cases mentioned above. The panel applet is just "nice to have" for control freaks, so we should ship it, but not activate by default.

Implementation

Code

  • The esound package is not installed by default any more, and replaced by pulseaudio-esound-compat.

  • The esound client library will still stay around to not break Gnome sound events and custom packages still relying on it.

  • Upstream is working on a clean and generic solution for the sound card file handle releasing on inactivity, but this will not be finished before spring 2007. After discussion with upstream, we decided that we will create our own simple patch for this for feisty, which might not fit well into the clean pulse architecture, but allow us to deploy, test, and benefit from it now without losing legacy compatibility.
  • Change gstreamer to prefer the pulse sink, and fall back to ALSA.
  • Change other applications in main to default to pulse output, if there is an available output module (xine, mplayer, libao (for Gaim), xmms, etc.).


Warning /!\ Edit conflict - other version:



Warning /!\ Edit conflict - your version:


  • Want to try : Lennart build this morning at UDS-MTV new packages for Edgy. You can test them by adding this repository:
    • deb http://ubuntu.ttoine.net/ edgy-music pulse

    • Look for Pulse Audio in Synaptic (Name & Description) and install packages wich names begin with "pulse" or "pa"

    • Of course, feel free to use them as a base for other purpose ; this repository is just done for my personal work for the Ubuntu-Studio project ; feedback if problem, see my page on wiki. [wiki:Ttoine ttoine]


Warning /!\ End of edit conflict


Data preservation and migration

Package upgrades will be handled through a transitional esound package added to Debian's pulseaudio source package (this will work because pulseaudio's version is higher than esound's). Data migration is not necessary.

Unresolved issues

  • We have to decide whether we use the Pulse mixer (which controls individual streams) or the gnome mixer (which controls the "hardware knobs" of the soundcard). None obsoletes the other, they do different things, and offer a different feature set/complexity.

Comments


CategorySpec

  • -- sklp


CategorySpec