c3lingo

Live interpretation of talks at Chaos events

User Tools

Site Tools


tech:noise_reduction_in_pulseaudio

Noise reduction in Pulseaudio

This document describes a simple noise and echo reduction setup you can apply to any mic if you're using Pulseaudio. Most modern Linux distributions use Pulseaudio.

You will need:

  • Any microphone, used as an input to your computer;
  • Pulseaudio version >=1.0

Trying it out

You can try the echo reduction module by running:

$  pactl load-module module-echo-cancel source_name=noechosource sink_name=noechosink

This will create a new source and sink pair you can use, connected to your current source and sink but with an echo and noise filter added. You can switch to using those in your distro's sound settings, or through the command-line with:

$ pacmd set-default-source noechosource

You can now record yourself, or try Mumble with someone. Do note that Mumble has its own noise reduction, see Noise reduction in Mumble.

If you want to undo these changes, you can do:

$ pactl unload-module module-echo-cancel

If things are irrevocably broken, you can always restart pulseaudio, none of these changes are permanent. Just run:

$ pulseaudio -k

to restart pulseaudio with its previous settings.

Making it permanent

To make these changes permanent, you can modify your pulseaudio settings (typically `/etc/pulse/default.pa`) and add these lines:

load-module module-echo-cancel source_name=noechosource sink_name=noechosink
set-default-source noechosource

Advanced configuration

The echo-cancel module has many tunable parameters you can adjust to optimize your own sound. Use at your own risk. See the official reference on freedesktop.org and the more comprehensive doc on Archlinux wiki.

Notes

Using the echo-cancelled sink

The module creates a pair of source and sink. The sink is useful if you're using speakers instead of a headset, and you want to hear yourself. This is not recommended because your mic will probably pick up the original audio as well. But if that is your only option, you can try changing your default sink to use the echo-cancelled one. Make sure you try that setup before translating, as it will probably require careful tuning before the talk to adjust the volume and gain correctly.

Making sure Mumble uses the right mic

Mumble may be configured to use your mic directly. You can change its input in Configure > Settings > Audio Input. You may also want to re-run the audio wizard (Configure > Audio Wizard) to adjust Mumble's noise cancellation levels.

tech/noise_reduction_in_pulseaudio.txt · Last modified: 2021/12/06 01:31 by sebalis