Skip to content

Commit

Permalink
home/services/rnnoise: inline config to file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Oct 7, 2024
1 parent 79e2077 commit 26af296
Showing 1 changed file with 36 additions and 38 deletions.
74 changes: 36 additions & 38 deletions modules/home/services/rnnoise/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,6 @@ let

json = pkgs.formats.json { };

pw_rnnoise_config = {
"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_stereo";
"control" = {
"VAD Threshold (%)" = 70.0;
};
}
];
};
"audio.position" = [
"FL"
"FR"
];
"capture.props" = {
"node.name" = "effect_input.rnnoise";
"node.passive" = true;
};
"playback.props" = {
"node.name" = "effect_output.rnnoise";
"media.class" = "Audio/Source";
};
};
}
];
};

cfg = config.${namespace}.services.rnnoise;
in
{
Expand All @@ -58,7 +21,42 @@ in

config = lib.mkIf cfg.enable {
xdg.configFile."pipewire/pipewire.conf.d/99-input-denoising.conf" = {
source = json.generate "99-input-denoising.conf" pw_rnnoise_config;
source = json.generate "99-input-denoising.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_stereo";
"control" = {
"VAD Threshold (%)" = 70.0;
};
}
];
};
"audio.position" = [
"FL"
"FR"
];
"capture.props" = {
"node.name" = "effect_input.rnnoise";
"node.passive" = true;
};
"playback.props" = {
"node.name" = "effect_output.rnnoise";
"media.class" = "Audio/Source";
};
};
}
];
};
};
};
}

0 comments on commit 26af296

Please sign in to comment.