Enable Native Echo Cancellation in Ubuntu (PipeWire)

This guide demonstrates how to enable system-wide, hardware-accelerated noise cancellation using the native PipeWire echo-cancel module. This is the cleanest way to filter audio without installing heavy third-party AI software.

1. Requirements

  • Operating System: Ubuntu 22.04+, Fedora 38+, or any modern distro running PipeWire.
  • Packages: pipewire, wireplumber, and libpipewire-0.3-modules.
  • Hardware: Any USB or Analog microphone (tested with MU900).

2. Get Your Microphone ID (PipeWire Native)

We need the internal "Node Name" of your hardware. Run this command to list your input devices using PipeWire's native tool:

pw-link -i | grep alsa_input

Look for the line that represents your microphone. It will look something like this:

alsa_input.usb-MU900_MU900_20190805V001-00.analog-stereo

3. The Configuration Script

Copy the code below. Replace the value of MY_MIC_NAME with the ID you found in Step 2 before running it.

# --- UPDATE THIS VARIABLE ---
MY_MIC_NAME="alsa_input.usb-MU900_MU900_20190805V001-00.analog-stereo"

# 1. Create the config directory
mkdir -p ~/.config/pipewire/pipewire.conf.d/

# 2. Write the configuration
cat < ~/.config/pipewire/pipewire.conf.d/99-echo-cancel.conf
context.modules = [
    { name = libpipewire-module-echo-cancel
        args = {
            source.props = {
                node.name = "Mic-NCNative"
                node.description = "Mic - NCNative"
            }
            capture.props = {
                node.passive = true
                # THIS LINE FIXES THE SILENCE:
                target.object = "$MY_MIC_NAME"
            }
        }
    }
]
EOF

# 3. Restart PipeWire services to apply changes
systemctl --user restart pipewire wireplumber

4. How to Use It

  1. Open your Settings > Sound.
  2. Look at your Input Device list.
  3. Select "Mic - NCNative" instead of your raw hardware microphone.

Your system is now passing your audio through the native WebRTC filtering engine. This happens at the PipeWire level before the audio even reaches your apps, effectively removing background hum and echo with zero latency.


Video Walkthrough

For a deeper look into PipeWire module configuration, check out this tutorial:

Watch: PipeWire Echo Cancellation Module Setup

تعليقات