Skip to content

Instantly share code, notes, and snippets.

@danielcosta
Created June 30, 2022 15:31
Show Gist options
  • Save danielcosta/e055ae931324b732fe3a1577b55d5b66 to your computer and use it in GitHub Desktop.
Save danielcosta/e055ae931324b732fe3a1577b55d5b66 to your computer and use it in GitHub Desktop.
Microphone settings for Linux

Fix Microphone Volume - or stop it from auto-adjustment

Check current volume

To see the current volume, run alsamixer. Let's consider the current volume shown is 40.

How to determine the .conf file for your microphone

Run pacmd list-sources.

In the output, search for the index: section listing the desired device, e.g.

* index: 6
  name: <alsa_input.usb-Blue_Microphones_Yeti_Stereo_Microphone_REV8-00.analog-stereo>
  ...
  active port: <analog-input-mic>

The active port part at the end contains the file name you need to edit in /usr/share/pulseaudio/alsa-mixer/paths/.

In the above example, it is <analog-input-mic>, so we would edit /usr/share/pulseaudio/alsa-mixer/paths/analog-input-mic.conf for this mic.

Apply settings

In the configuration file /usr/share/pulseaudio/alsa-mixer/paths/analog-input-internal-mic.conf (you might have to look for the correct file for your microphone, see below), I changed to part

[Element Capture]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

to

[Element Capture]
switch = mute
volume = 40
override-map.1 = all
override-map.2 = all-left,all-right

and after a sudo alsa force-reload, applications don't magically change the microphone volume anymore.

Reference:

https://askubuntu.com/questions/689209/how-to-disable-microphone-volume-auto-adjustment-in-cisco-webex

# Microphone Realtime background noise reduction script
# author Luigi Maselli - https://grigio.org licence: AS-IS
# credits: http://askubuntu.com/questions/18958/realtime-noise-removal-with-pulseaudio
# run as: sudo && pulseaudio -k
sudo cp /etc/pulse/default.pa /etc/pulse/default.pa.bak
sudo cat <<EOT >> /etc/pulse/default.pa
load-module module-echo-cancel source_name=noechosource sink_name=noechosink
set-default-source noechosource
set-default-sink noechosink
EOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment