Noise reduction for recording using PulseAudio
When I perform sound recording using the microphone on my Logitech H151 headset as well as the default HDA Intel PCH sound card on my PC, there is too much noise. Then I use the following steps to reduce the noise level.
-
Check if
module-echo-cancel
is loaded byPulseAudio
. Usually, it is not enabled by default. Therefore, the following command will return nothing.pacmd list-modules | grep module-echo-cancel
-
At the moment, there are two audio input devices on my PC. Besides the input of the said sound card HDA Intel PCH, the other is the microphone in my Logitech C930C webcam. Therefore, I need to know the ALSA device name of HDA Intel PCH’s input by executing this command:
pacmd list-sources | grep name: | grep input
-
Add the following lines in
/etc/pulseaudio/default.pa
to enable echo and noise cancellation for HDA Intel PCH.## When analog_gain_control=1, there will be distortion. Therefore, set it to 0. ## When digital_gain_control=1, automatic gain control is done in post processing by CPU. .ifexists module-echo-cancel.so load-module module-echo-cancel source_master=alsa_input.pci-0000_00_1b.0.analog-stereo aec_method=webrtc aec_args="analog_gain_control=0 digital_gain_control=1" source_name=echoCancel_source sink_name=echoCancel_sink .endif ### Make some devices default ## set-default-sink echoCancel_sink set-default-source echoCancel_source
N.B.
- In
PulseAudio
, asource
is a device that can emit digital audio stream toPulseAudio
, e.g. microphone, line input, or some entity which is not a physical audio device but can still generate the audio stream. On the other hand, asink
is a device that can output digital audio stream fromPulseAudio
, such as speaker signal, headphone output, etc. Still, asink
may not be a physical audio device. source_master
in the above configuration specifies the soundsource
, which is the ALSA input device in the HDA Intel PCH sound card.source_name
in the above configuration is thePulseAudio
device name. The audio stream from this device will be filtered to a small noise level.
- In
-
Restart
PulseAudio
serverpulseaudio -k pulseaudio --start
-
References