noise-suppression-for-voice icon indicating copy to clipboard operation
noise-suppression-for-voice copied to clipboard

Question: also usable for output?

Open Nudin opened this issue 3 years ago • 5 comments

Thanks a lot for your effort creating this plugin! For long time I'm searching (again) for ways to use RNNoise to watch noisy video lectures without the noise. The readme only talks about using this plugin to denoise the input from the microphone, but it should also work the other way around, denoising the sound coming from one application (i.e. video player) and forwarding the denoised results to the speaker, right? Or is there a reason against this?

Nudin avatar Jul 09 '20 09:07 Nudin

You should be able to denoise the output from the apps, I don't have exact config ready - https://github.com/toadjaune/pulseaudio-config could be helpful.

I don't see any complications or reasons no to do this.

werman avatar Jul 09 '20 09:07 werman

Something like this should work, change sink_master to your output (you could find it via pacmd list-sinks | grep -e 'name:')

load-module module-ladspa-sink sink_name=denoise_sink_for_apps.stereo sink_master=alsa_output.pci-0000_0c_00.3.analog-stereo label=noise_suppressor_stereo plugin=librnnoise_ladspa.so control=0

werman avatar Jul 09 '20 18:07 werman

Works! Should we document this?

Nudin avatar Jul 16 '20 15:07 Nudin

Yes, however last time I tried I had some issues, I want to check if it work for me before adding to docs.

werman avatar Jul 16 '20 15:07 werman

I spent a long time figuring out whats going on here, I was also experiencing issues with this one liner. PA in general seems to have some issues with resampling. And I would constantly get crackles in the audio.

The only way I could get it to work was an overly complicated setup to give PA a buffer before an after the ladspa sink, that introduces some latency.

load-module module-null-sink sink_name=nui_out_out_sink
load-module module-null-sink sink_name=nui_out_in_sink
load-module module-ladspa-sink sink_name=nui_out_ladspa sink_master=nui_out_out_sink label=noise_suppressor_mono channels=1 plugin=librnnoise_ladspa.so control=95 rate=48000
load-module module-loopback source=nui_out_out_sink.monitor sink=alsa_output.pci-0000_0c_00.3.analog-stereo channels=2 latency_msec=50 source_dont_move=true sink_dont_move=true
load-module module-loopback source=nui_out_in_sink.monitor sink=nui_out_ladspa channels=1 latency_msec=50 source_dont_move=true sink_dont_move=true

Maybe someone can find a saner way, but I couldn't get it to work stable on my machine otherwise.

lawl avatar Dec 13 '20 08:12 lawl