How to enable Microphone Input Echo / Noise Cancellation on your Linux Desktop (PulseAudio)

PulseAudio comes with a module that can be utilized to carry out acoustic echo cancellation of the microphone enter, and a few background noise discount. This module isn’t enabled by default on most (if not all) Linux distributions, so this text will present you learn how to allow it.

I am going to present you 2 methods of enabling the PulseAudio Echo Cancel module: one which makes it everlasting so it is mechanically began while you login to your desktop, and one other one which lets you allow echo cancellation on demand, while you want it.

This isn’t simply to supply 2 alternate options, but additionally to work round a PulseAudio bug that occurs for instance when plugging in a headset after loading the Echo Cancel module, which causes this to not swap mechanically to the brand new sink_master. Additionally, in my case, having module-echo-cancel load at startup doesn’t work in any respect (I am undecided why), however it may be loaded after logging in with no points, utilizing the second technique beneath.

How one can allow the PulseAudio module-echo-cancel on startup

To at all times have echo / noise cancellation in your Linux desktop utilizing PulseAudio, having module-echo-cancel loaded at startup, comply with the steps beneath.

1. Edit /and many others/pulse/default.pa as root with a textual content editor, like Nano (command line textual content editor) for instance:

sudo nano /and many others/pulse/default.pa

Scroll all the way down to the tip of this file and paste the next:

.ifexists module-echo-cancel.so
load-module module-echo-cancel aec_method=webrtc source_name=echocancel sink_name=echocancel1
set-default-source echocancel
set-default-sink echocancel1
.endif

That is what this does: in case your system PulseAudio is compiled with the echo / noise cancellation module, load this module, use webrtc because the echo cancellation technique (it ought to be higher than the default speex), specify a supply and sink names, then set that supply and sink as default.

2. After saving the file, reload PulseAudio utilizing this command:

pulseaudio -k

Or reboot your laptop.

After this, look in your system’s sound settings and the enter and output gadgets ought to each have the default title, however with “echo cancelled with…” in parentheses, e.g. “Constructed-in Audio Analog Stereo (echo cancelled with Constructed-in Audio Analog Stereo)” like within the screenshot on the prime of the article.

This could persist via reboots.

If this does not be just right for you, see the second technique beneath, for learn how to load module-echo-cancel on demand.

How one can allow the PulseAudio module-echo-cancel on demand

To have echo / noise cancellation of the microphone enter solely while you want it (by having an utility menu entry to show this on), comply with the steps beneath.

1. Create a brand new file in your house folder known as echocancel with the next contents:

#!/usr/bin/env bash
pactl unload-module module-echo-cancel
pactl load-module module-echo-cancel aec_method=webrtc source_name=echocancel sink_name=echocancel1
pacmd set-default-source echocancel
pacmd set-default-sink echocancel1

This unloads module-echo-cancel if it was already loaded, then masses this module with webrtc because the echo cancellation technique (it ought to be higher than the default speex), specify a supply and sink names, then set that supply and sink as default.

2. After saving the file, make it executable and duplicate it someplace in your path. You can also make it executable and place it in /usr/native/bin utilizing this command:

sudo set up echocancel /usr/native/bin

3. Create a file known as echocancel.desktop in your house folder with the next contents:

[Desktop Entry]
Model=1.0
Identify=Echo Cancel PulseAudio Module
Remark=Load the PulseAudio module-echo-cancel
Exec=echocancel
Icon=multimedia-volume-control
Kind=Software
Classes=AudioVideo;Audio;

4. Save the file and duplicate it to ~/.native/share/purposes/, e.g. do that from the command line utilizing:

cp echocancel.desktop ~/.native/share/purposes/

You must now see a brand new entry known as Echo Cancel PulseAudio Module in your purposes menu. While you click on on it, it ought to load the echo / noise cancelling PulseAudio quantity.

After you run this, look in your system’s sound settings and the enter and output gadgets ought to each have the default title, however with “echo cancelled with…” in parentheses, like within the screenshot on the prime of the article.

In case you wish to unload the echo cancel PulseAudio module you possibly can run:

pactl unload-module module-echo-cancelFor extra on this, see the PulseAudio module-echo-cancel documentation.

pulseaudio daemon startup failed,pulseaudio dummy output,pulseaudio module-echo-cancel,restart pulseaudio,pulseaudio set-default device,pulseaudio loopback,alsa noise cancellation,echo cancelation ubuntu,acoustic echo cancellation linux,ubuntu 18.04 microphone noise,linux microphone hiss,noisegator linux,module-echo-cancel,failed to load module module-echo-cancel,linux active noise cancellation,linux mint microphone noise,pulseaudio echo,pulseaudio noise cancellation,reset pulseaudio settings,restart pulseaudio arch,pulseaudio microphone

Share: