PulseaudioProfiles

Revision 1 as of 2013-04-15 14:47:35

Clear message

Introduction to PulseAudio profiles and ports

For controlling audio volume and mute, PulseAudio provides an abstraction layer over ALSA. ALSA often exposes a bewildering list of mixer controls, and the end user probably just wants to control the main volume, not several volumes.

However, which volume to control, depend on the currently active output (or input). Some ALSA volume control might be necessary for controlling Headphones volume, and another for Speaker volume. There might be additional controls needed to be set for audio to be output at all.

To describe what mixer controls PulseAudio needs to set for a particular output, PulseAudio uses path files. There is also a profile-set file that describes which path files to look for, and an udev rule to determine which profile-set file will be used for a particular hardware.

The upstream documentation for how to write profile and path files is here. There is also documentation inside these files.

Android also has mixer files

Android devices, at least some of them, have mixer files in an xml format. These can provide very good hints of how to write your paths. Here is how the mixer xml file looks for Nexus7, which will be used as an example in this guide.

Path files

In my example, I have the following paths defined in the Android mixer file:

<path name="speaker">
</path>
<path name="headphone">
</path>
<path name="main-mic-top">
</path>
<path name="main-mic-left">
</path>
<path name="headset-mic">
</path>

This would typically correspond to similar path files in PulseAudio. I chose to create paths for

  • Speaker
  • Headphone
  • Mic (built-in)

PulseAudio does not support switching port depending on current rotation, and the headset-mic path present is probably bogus, because Nexus7 does not support headset mics (at least so I've been told).

Volumes and mutes

Switching port on device plugin

TBW

What about UCM?

UCM is another abstraction layer for mixer controls. Its implementation in PulseAudio is still immature (as of Ubuntu 13.04), as it does not support, e g, mapping an ALSA mixer control to the main PulseAudio volume.