nixos-config/user/rnnoise.nix
2022-08-19 20:47:20 -03:00

44 lines
1.5 KiB
Nix

{ config, pkgs, lib, ... }: {
# RNNoise is a noise supperssion neural network
# Here we use it as a plugin for pipewire to create a virtual microphone
config = {
home.file = {
".config/pipewire/pipewire.conf.d/99-input-denoising.conf".text = ''
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 (%)" 95.0
"VAD Grace Period (ms)" 200
"Retroactive VAD Grace (ms)" 100
}
}
]
}
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
}
}
}
]
'';
};
};
}