Skip to content

Instantly share code, notes, and snippets.

@velitasali
Last active September 29, 2023 15:07
Show Gist options
  • Save velitasali/3c5f672ea88365b45f8b18ca1b3605ac to your computer and use it in GitHub Desktop.
Save velitasali/3c5f672ea88365b45f8b18ca1b3605ac to your computer and use it in GitHub Desktop.
Static noise microphone issue with PulseAudio. On Linux, single channel mic inputs sometimes detected as stereo channel inputs. This causes static noise and unusable experience. To fix it, we need to route the left channel to a mono channel source. We also enable noise cancellation to remove fan and other hardware noises. For more information ht…
# /etc/pulse/
# This change is optional if you are not satisfied with sound quality. Please try different bitrate options and
# use the most compatible one. For instance, you may run "arecord -f dat -r 48000 -D hw:0,0 -d 5 test.wav" to
# record a sample audio. Change the bitrate accordingly by using "r" option.
default-sample-rate = 48000
alternate-sample-rate = 44100
# /etc/pulse/
# Create a source using left channel of the built-in mic
load-module module-remap-source source_name=record_mono master=alsa_input.pci-0000_00_1f.3.analog-stereo master_channel_map=front-left channel_map=mono
# Create another source using the source we created above. This will be referred to as echo cancelling input.
load-module module-echo-cancel source_name=record_mono aec_method=webrtc format=s16le rate=44100 channels=1
# Set the echo-cancelling input as the default input.
set-default-source record_mono
@PedroRajao
Copy link

PedroRajao commented Aug 18, 2021

It worked for me!

@Staninna
Copy link

Thank you i bookmarked this because it happens a lot to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment