diff options
-rw-r--r-- | tools/nsfv-setup/default.nix (renamed from users/tazjin/nsfv-setup/default.nix) | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/users/tazjin/nsfv-setup/default.nix b/tools/nsfv-setup/default.nix index 65f94034da42..aa3567c56ae1 100644 --- a/users/tazjin/nsfv-setup/default.nix +++ b/tools/nsfv-setup/default.nix @@ -7,12 +7,21 @@ # 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. +# +# If this script is run while an NSFV sink exists, the existing sink +# will first be removed. { pkgs, ... }: let inherit (pkgs) ripgrep pulseaudio nsfv; in pkgs.writeShellScriptBin "nsfv-setup" '' + export PATH="${ripgrep}/bin:${pulseaudio}/bin:$PATH" + + if pacmd list-sinks | rg librnnoise_ladspa.so >/dev/null; then + pactl unload-module module-ladspa-sink + fi + 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 + ${pulseaudio}/bin/pacmd load-module module-ladspa-sink sink_name=NSFV sink_master=''${SINK} label=noise_suppressor_mono plugin=${pkgs.nsfv}/lib/ladspa/librnnoise_ladspa.so control=42 '' |