Add Echo cancelling to your mic using pipewire!

Fri, 11 Aug 2023

We will be adding a new source which will output the echo-cancelled audio.

Just create this config file with the following content.

~/.config/pipewire/pipewire.conf.d/echo-cancel.conf

 context.modules = [
  {   name = libpipewire-module-echo-cancel
      args = {
          # library.name  = aec/libspa-aec-webrtc
          # node.latency = 1024/48000
          # monitor.mode = false
          capture.props = {
             node.name = "Echo Cancellation Capture"
          }
          source.props = {
             node.name = "Echo Cancellation Source"
          }
          sink.props = {
             node.name = "Echo Cancellation Sink"
          }
          playback.props = {
             node.name = "Echo Cancellation Playback"
          }
      }
  }
]

(This was taken from the official pipewire documentation)

You will now need to restart pipewire.

systemctl --user restart pipewire

Now restart any application that is using your mic, and you should see a new “Echo-Cancel Source” :)

Finishing touches

To make sure that your mic is loud enough, make sure to use alsamixer (available from alsa-utils package) and change the Internal Mic Boost to match your preferance.