pulse-autoconf

Releases

PulseAudio server dynamic configuration daemon

Overview

Pulse-autoconf monitors a running PulseAudio server instance and ensures that a certain configuration is in place.

A primary goal of pulse-autoconf is to supply automatic echo cancellation that "just works" for e.g. voice chats or video conferencing, as one is used to already with other devices such as smartphones.
PulseAudio does feature decent echo cancellation, but unfortunately it is somewhat awkward to set up and it does not automatically adapt to devices being added or removed, for example when you plug in or unplug a headset.

This is where pulse-autoconf may help. For example, its built-in "EchoCancellation" preset makes sure that echo cancellation is always active between a dynamically determined master source and master sink, and that the virtual echo cancellation devices are set as fallbacks. If sources or sinks are added or removed, the echo cancellation is unloaded and re-applied to now possibly different masters, and affected streams are moved to the new virtual echo cancellation devices.

Features

Built-in presets

Out-of-the-box pulse-autoconf comes with two presets that can be applied to the PulseAudio server. Symbology:

(Application), {Audio source}, [Audio sink], {m} = Monitor of audio sink
{}* = Fallback ("default") source
[]* = Fallback ("default") sink

EchoCancellation

This preset determines a master source and master sink, for example a headset's microphone and speakers, and sets up echo cancellation between them:

{Microphone}
    ||
{src_main}* --------------> (Voice chat) -------------> [sink_main]*
                                                            ||
                                                        [Speakers]

EchoCancellationWithSourcesMix

This preset also provides echo cancellation between a master source and sink. In addition to that, it creates a virtual sink for sound effects, "sink_fx".

Any audio that is played into "sink_fx" is relayed to the speakers as well as to another virtual sink "sink_mix", where it is mixed together with the microphone.
An application that records from "Monitor of sink_mix" will receive both the audio from the microphone and the audio that is being played into "sink_fx".

With this, one can play additional audio into e.g. a voice chat or streaming application.

{Microphone}
    ||
{src_ec} -----------------> [sink_mix]{m}* -----------> (Voice chat)
              Loopback            ^                          |
                                  | Loopback                 |
                                  |                          v
(Soundboard) ---------> [sink_fx]{m} -----------------> [sink_main]*
                                          Loopback          ||
                                                        [Speakers]

For more information about this setup see Mixing additional audio into the microphone's audio at the ArchWiki.

Usage

pulse-autoconf

As of version 0.0.4 pulse-autoconf does not parse arguments. Instead, it sources these configuration files, in this order, wildcards expanded alphabetically:

The manual page is not written yet, so to see the available settings for now please have a look at the source code and do a text search for "setDefaultSettings".

Troubleshooting

Sample rate drops to 32000 Hz when echo cancellation is active

Contrary to the PulseAudio module documentation, in some constellations setting the echo cancellation parameter "use_master_format=1" may not be enough to make WebRTC echo cancellation use the physical device's sample rate.

It might be that WebRTC echo cancellation supports sample rates of 32000 Hz and 48000 Hz, but not 44100 Hz, and if your physical device uses/prefers 44100 Hz then PulseAudio compromises to 32000 Hz, which is an audible difference to the worse.

As a workaround you can explicitely specify a sample rate of 48000 Hz with the module's "rate" parameter, for example by adding "ecParams+=(rate=48000)" to a pulse-autoconf configuration file.

License

GNU General Public License version 3

Packages

Browseable sources

These source files of the latest tag can be viewed in the browser:

Releases

pulse-autoconf-0.0.4

31 August 2020 (2020-08-31 17:31:51 UTC)

pulse-autoconf-0.0.4.tar.gz SHA256 checksum SHA384 checksum PGP signature

pulse-autoconf-0.0.3

10 August 2020 (2020-08-10 22:01:24 UTC)

pulse-autoconf-0.0.3.tar.gz SHA256 checksum SHA384 checksum PGP signature

pulse-autoconf-0.0.2

06 August 2020 (2020-08-06 21:54:12 UTC)

pulse-autoconf-0.0.2.tar.gz SHA256 checksum SHA384 checksum PGP signature