Audio pipewire virtual devices and noise suppression setup

Topics relating to audio.

nkukard

OpenSourceCoder
Staff member
Member
1
Jun 10, 2023
70
4
16
Linux.Chat
linux.chat
Pronouns
He/Him
Shell
  1. Bash
  2. ZSH
Editor
  1. Vim
  2. VSCode/Code
Desktop
  1. KDE
Many people have asked me how I set up my audio devices and noise suppression system wide, here is the configs I use.

I use two virtual loopback devices.
  • All my instant message and network notifications point to my "virtual" audio device, which outputs to my ear buds.
  • My music, virtual machines and streaming audio all output to my "stream" audio device, which outputs to my "virtual" audio device.
  • My mic feeds the "noise suppression" audio device, which outputs to OBS and my virtual machines

Here is my virtual device setup...
Code:
$ cat ~/.config/pipewire/pipewire.conf.d/nk-virtuals.conf
context.modules = [
        {
                name = libpipewire-module-loopback
                args = {
                        node.description = "Virtual"
                        capture.props = {
                                node.name = "virtual_capture"
                                media.class = "Audio/Sink"
                                audio.position = [ FL FR ]
                        }
                        playback.props = {
                        node.name = "virtual_playback"
                                audio.position = [ FL FR ]
                                stream.dont-remix = true
                        }
                }
        }
        {
                name = libpipewire-module-loopback
                args = {
                        node.description = "Stream"
                        capture.props = {
                                node.name = "stream_capture"
                                media.class = "Audio/Sink"
                                audio.position = [ FL FR ]
                        }
                        playback.props = {
                        node.name = "stream_playback"
                                audio.position = [ FL FR ]
                                stream.dont-remix = true
                        }
                }
        }
]


Here is my noise suppression setup...
Code:
$ cat ~/.config/pipewire/pipewire.conf.d/nk-noise-suppression.conf
context.modules = [
{   name = libpipewire-module-filter-chain
        args = {
                node.description =  "Noise Canceling source"
                media.name =  "Noise Canceling source"
                filter.graph = {
                        nodes = [
                                {
                                        type = ladspa
                                        name = rnnoise
                                        plugin = /usr/lib/ladspa/librnnoise_ladspa.so
                                        label = noise_suppressor_stereo
                                        control = {
                                                "VAD Threshold (%)" = 50.0
                                                "VAD Grace Period (ms)" = 200
                                                "Retroactive VAD Grace (ms)" = 0
                                        }
                                }
                        ]
                }
                capture.props = {
                        node.name =  "capture.rnnoise_source"
                        node.passive = true
                        audio.rate = 48000
                        node.target = "alsa_input.usb-audio-technica_AT2020USB_-00.analog-stereo"
                }
                playback.props = {
                        node.name =  "rnnoise_source"
                        media.class = Audio/Source
                        audio.rate = 48000
                }
        }
}
]
 

About Us

  • The Linux.Chat community is a multi-platform community for general Linux® support. We provide help and support for any Linux® distribution and aim to answer any questions you might have about Linux®. Discussion about the various aspects of Linux® and Free/Open Source software is also encouraged.

    Visit our communities website at Linux.Chat.
  • Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

Quick Navigation

User Menu