mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Packages+Services/pipewire-noise-filter] Add dedicated file for pipewire-noise-filter.conf
Makes desktop.nix _much_ cleaner
This commit is contained in:
parent
71f5d703f2
commit
32dc9c6536
2 changed files with 64 additions and 55 deletions
58
desktop.nix
58
desktop.nix
|
|
@ -3,61 +3,9 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.aviallon.desktop;
|
cfg = config.aviallon.desktop;
|
||||||
generalCfg = config.aviallon.general;
|
generalCfg = config.aviallon.general;
|
||||||
filterConfig = pkgs.writeText "pipewire-noise-filter.cfg" ''
|
filterConfig = pkgs.callPackage ./packages/pipewire-noise-filter.cfg.nix {
|
||||||
# Noise canceling source
|
noiseFilterStrength = cfg.audio.noise-filter.strength;
|
||||||
#
|
};
|
||||||
# start with pipewire -c filter-chain/source-rnnoise.conf
|
|
||||||
#
|
|
||||||
context.properties = {
|
|
||||||
log.level = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
context.spa-libs = {
|
|
||||||
audio.convert.* = audioconvert/libspa-audioconvert
|
|
||||||
support.* = support/libspa-support
|
|
||||||
}
|
|
||||||
|
|
||||||
context.modules = [
|
|
||||||
{ name = libpipewire-module-rtkit
|
|
||||||
args = {
|
|
||||||
#nice.level = -11
|
|
||||||
#rt.prio = 88
|
|
||||||
#rt.time.soft = 200000
|
|
||||||
#rt.time.hard = 200000
|
|
||||||
}
|
|
||||||
flags = [ ifexists nofail ]
|
|
||||||
}
|
|
||||||
{ name = libpipewire-module-protocol-native }
|
|
||||||
{ name = libpipewire-module-client-node }
|
|
||||||
{ name = libpipewire-module-adapter }
|
|
||||||
|
|
||||||
{ name = libpipewire-module-filter-chain
|
|
||||||
args = {
|
|
||||||
node.name = "rnnoise_source"
|
|
||||||
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 (%)" ${toString cfg.audio.noise-filter.strength}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
capture.props = {
|
|
||||||
node.passive = true
|
|
||||||
}
|
|
||||||
playback.props = {
|
|
||||||
media.class = Audio/Source
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]'';
|
|
||||||
in {
|
in {
|
||||||
options.aviallon.desktop = {
|
options.aviallon.desktop = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
|
|
||||||
61
packages/pipewire-noise-filter.cfg.nix
Normal file
61
packages/pipewire-noise-filter.cfg.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
{ lib
|
||||||
|
, writeText
|
||||||
|
, rnnoise-plugin
|
||||||
|
, noiseFilterStrength
|
||||||
|
}:
|
||||||
|
|
||||||
|
writeText "pipewire-noise-filter.cfg" ''
|
||||||
|
# Noise canceling source
|
||||||
|
#
|
||||||
|
# start with pipewire -c filter-chain/source-rnnoise.conf
|
||||||
|
#
|
||||||
|
context.properties = {
|
||||||
|
log.level = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
context.spa-libs = {
|
||||||
|
audio.convert.* = audioconvert/libspa-audioconvert
|
||||||
|
support.* = support/libspa-support
|
||||||
|
}
|
||||||
|
|
||||||
|
context.modules = [
|
||||||
|
{ name = libpipewire-module-rtkit
|
||||||
|
args = {
|
||||||
|
#nice.level = -11
|
||||||
|
#rt.prio = 88
|
||||||
|
#rt.time.soft = 200000
|
||||||
|
#rt.time.hard = 200000
|
||||||
|
}
|
||||||
|
flags = [ ifexists nofail ]
|
||||||
|
}
|
||||||
|
{ name = libpipewire-module-protocol-native }
|
||||||
|
{ name = libpipewire-module-client-node }
|
||||||
|
{ name = libpipewire-module-adapter }
|
||||||
|
|
||||||
|
{ name = libpipewire-module-filter-chain
|
||||||
|
args = {
|
||||||
|
node.name = "rnnoise_source"
|
||||||
|
node.description = "Noise Canceling source"
|
||||||
|
media.name = "Noise Canceling source"
|
||||||
|
filter.graph = {
|
||||||
|
nodes = [
|
||||||
|
{
|
||||||
|
type = ladspa
|
||||||
|
name = rnnoise
|
||||||
|
plugin = ${rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so
|
||||||
|
label = noise_suppressor_stereo
|
||||||
|
control = {
|
||||||
|
"VAD Threshold (%)" ${toString noiseFilterStrength}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
capture.props = {
|
||||||
|
node.passive = true
|
||||||
|
}
|
||||||
|
playback.props = {
|
||||||
|
media.class = Audio/Source
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]''
|
||||||
Loading…
Add table
Add a link
Reference in a new issue