about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--third_party/default.nix1
-rw-r--r--users/tazjin/nsfv-setup/default.nix18
2 files changed, 19 insertions, 0 deletions
diff --git a/third_party/default.nix b/third_party/default.nix
index b4b799e8ee59..934eee15711a 100644
--- a/third_party/default.nix
+++ b/third_party/default.nix
@@ -106,6 +106,7 @@ let
       pkgconfig
       postgresql
       pounce
+      pulseaudio
       python3
       python3Packages
       remarshal
diff --git a/users/tazjin/nsfv-setup/default.nix b/users/tazjin/nsfv-setup/default.nix
new file mode 100644
index 000000000000..65f94034da42
--- /dev/null
+++ b/users/tazjin/nsfv-setup/default.nix
@@ -0,0 +1,18 @@
+# Configures a running Pulseaudio instance with an LADSP filter that
+# creates a noise-cancelling sink.
+#
+# This can be used to, for example, cancel noise from an incoming
+# video conferencing audio stream.
+#
+# There are some caveats, for example this will not distinguish
+# between noise from different participants and I have no idea what
+# happens if the default sink goes away.
+{ pkgs, ... }:
+
+let
+  inherit (pkgs) ripgrep pulseaudio nsfv;
+in pkgs.writeShellScriptBin "nsfv-setup" ''
+  SINK=$(${pulseaudio}/bin/pacmd info | ${ripgrep}/bin/rg -r '$1' '^Default sink name: (.*)$')
+  echo "Setting up NSFV filtering to sink ''${SINK}"
+  ${pulseaudio}/bin/pacmd load-module module-ladspa-sink sink_name=NSFV sink_master=''${SINK} label=noise_suppressor_stereo plugin=${pkgs.nsfv}/lib/ladspa/librnnoise_ladspa.so control=50
+''