From 0e14c32fef5ad57b7131f2356c9389ff548b7069 Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Wed, 9 Aug 2023 23:06:03 +0200 Subject: [PATCH] Re add rnnoise --- modules/audio/default.nix | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/modules/audio/default.nix b/modules/audio/default.nix index 7e8e95c..98e3120 100644 --- a/modules/audio/default.nix +++ b/modules/audio/default.nix @@ -17,6 +17,41 @@ hardware.pulseaudio.enable = false; - + environment.etc = let + json = pkgs.formats.json {}; + in { + "pipewire/pipewire.conf.d/91-rnnoise.conf".source = json.generate "91-rnnoise.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 = "${pkgs.rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so"; + label = "noise_suppressor_mono"; + 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; + }; + playback.props = { + node.name = "rnnoise_source"; + media.class = "Audio/Source"; + audio.rate = 48000; + }; + }; + }]; + }; + }; }