summaryrefslogtreecommitdiffstats
path: root/setup-noise-suppression
blob: 699ca429fe99b0d68a41d0aa947ca8b886f2e1e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
#
# Set up rnnoise-based microphone noise filtering
#
# - Install the ladspa noise-suppression plugin form here: https://github.com/werman/noise-suppression-for-voice
# - Then use this script to play around with the settings until you have something that works well.
#    + Find potential sources with: pacmd list-sources | awk -F'[<>]' '/name: /{print $2}'
# - Finally, put the "load-module *" lines into your /etc/pulse/default.pa for persistence.

source="$1"
control="${2:-40}"
channels="${3:-2}"

pacmd unload-module module-null-sink

pacmd load-module module-null-sink sink_name=mic_denoised_out rate=48000 format=s16le
pacmd load-module module-ladspa-sink sink_name=mic_raw_in sink_master=mic_denoised_out label=noise_suppressor_mono plugin=/usr/lib/ladspa/librnnoise_ladspa.so control="$control"
pacmd load-module module-loopback source="$source" sink=mic_raw_in channels="$channels" source_dont_move=true sink_dont_move=true latency_msec=1

# remap to regular source for chromium
pacmd load-module module-remap-source source_name=denoised master=mic_denoised_out.monitor channels="$channels"