From f1551d16b1ee7839398ef3d5cb1754e17fde3f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Sat, 13 Aug 2022 14:25:32 -0300 Subject: [PATCH] Add RNNoise --- user/home.nix | 3 +++ user/rnnoise.nix | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 user/rnnoise.nix diff --git a/user/home.nix b/user/home.nix index 8b118f4..1928f31 100644 --- a/user/home.nix +++ b/user/home.nix @@ -19,6 +19,7 @@ in { ./qutebrowser ./gpg.nix ./rofi.nix + ./rnnoise.nix ]; # Home Manager needs a bit of information about you and the # paths it should manage. @@ -64,6 +65,8 @@ in { imagemagick mpv mpc-cli + helvum + gimp # pulse_sink #games lutris diff --git a/user/rnnoise.nix b/user/rnnoise.nix new file mode 100644 index 0000000..746e189 --- /dev/null +++ b/user/rnnoise.nix @@ -0,0 +1,44 @@ +{ config, pkgs, lib, ... }: +{ + # RNNoise is a noise supperssion neural network + # Here we use it as a plugin for pipewire to create a virtual microphone + config = { + home.file = { + ".config/pipewire/pipewire.conf.d/99-input-denoising.conf".text = '' + 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 = ${pkgs.rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so + label = noise_suppressor_mono + control = { + "VAD Threshold (%)" 95.0 + "VAD Grace Period (ms)" 200 + "Retroactive VAD Grace (ms)" 100 + } + } + ] + } + capture.props = { + node.name = "capture.rnnoise_source" + node.passive = true + audio.rate = 48000 + } + playback.props = { + node.name = "rnnoise_source" + media.class = Audio/Source + audio.rate = 48000 + } + } + } + ] + ''; + }; + }; +}