You are not logged in.

#1 2024-11-15 17:34:45

le_grande_castel
Member
Registered: 2022-05-16
Posts: 10

[SOLVED] How to stop microphone gain from adjusting automatically?

Hello, title basically

I am using Arch Linux and I have often noticed that my microphone goes down to unhearable levels automatically, I think I narrowed the issue down to Chromium-based applications. Been having this issue in Google Meets in Chromium browser, and Electron apps such as Vesktop. I hate it, it's unbearable, the other person does not hear it. It's gotten to the point where I have to keep adjsuting  the volume constantly.

I have google'd how to disable this ""feature"", and aside from basic info like "disable gain in discord" that does nothing (it is disabled), and scripts that refresh the volume 10 times every second, I have not found any relevant solution.

Does anyone know how to solve this? I know in Chromium you can set the chrome flags to disable this, but is there a way to do it system-wide for all Electron apps? Or even better, to lock system-wide audio to what I set it?

I will provide any necessary info I missed

Last edited by le_grande_castel (2024-11-16 05:26:02)

Offline

#2 2024-11-15 17:45:27

cryptearth
Member
Registered: 2024-02-03
Posts: 1,034

Re: [SOLVED] How to stop microphone gain from adjusting automatically?

usually this issue is reported the other way: due to inactivity the open-mic gain keeps increasing and become a loud white noise until the user gets it to reajust by talking again (had this issue for long time with a friend of mine who not cared to properly adjust his noise gate and auto-voice levels)
does the volume/gain readjust itself after you started talkibg again? does the gain decrease while you're talkin? what mic do you use? how is it connected? is the system a laptop?

Last edited by cryptearth (2024-11-15 20:23:37)

Offline

#3 2024-11-15 18:01:07

le_grande_castel
Member
Registered: 2022-05-16
Posts: 10

Re: [SOLVED] How to stop microphone gain from adjusting automatically?

I can not notice any noise on the mic that would do that, and this happens exclusively on Chromium (or Electron) apps, that's why I believe this might be the culprit. It does not happen in Firefox for instance. The gain decreases when I talk, it does not readjust again, usually only down. I have a Samsun Meteor mic. It is connected via USB. The system is not a laptop.

Offline

#4 2024-11-15 18:50:39

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,319

Re: [SOLVED] How to stop microphone gain from adjusting automatically?

Pipewire has a quirk property to disallow applications messing with the source volume (funnily enough it has a commented, literal example for discord in /usr/share/pipewire/pipewire-pulse.conf): Create the section in e.g. /etc/pipewire/pipewire-pulse.d/10-adjustQuirkRules.conf

pulse.rules = [
    {
        matches = [
            {
                # all keys must match the value. ! negates. ~ starts regex.
                #client.name                = "Firefox"
                #application.process.binary = "teams"
                #application.name           = "~speech-dispatcher.*"
            }
        ]
        actions = {
            update-props = {
                #node.latency = 512/48000
            }
            # Possible quirks:"
            #    force-s16-info                 forces sink and source info as S16 format
            #    remove-capture-dont-move       removes the capture DONT_MOVE flag
            #    block-source-volume            blocks updates to source volume
            #    block-sink-volume              blocks updates to sink volume
            #quirks = [ ]
        }
    }
    {
        # skype does not want to use devices that don't have an S16 sample format.
        matches = [
             { application.process.binary = "teams" }
             { application.process.binary = "teams-insiders" }
             { application.process.binary = "skypeforlinux" }
        ]
        actions = { quirks = [ force-s16-info ] }
    }
    {
        # firefox marks the capture streams as don't move and then they
        # can't be moved with pavucontrol or other tools.
        matches = [ { application.process.binary = "firefox" } ]
        actions = { quirks = [ remove-capture-dont-move ] }
    }
    {
        # speech dispatcher asks for too small latency and then underruns.
        matches = [ { application.name = "~speech-dispatcher.*" } ]
        actions = {
            update-props = {
                pulse.min.req          = 512/48000      # 10.6ms
                pulse.min.quantum      = 512/48000      # 10.6ms
                pulse.idle.timeout     = 5              # pause after 5 seconds of underrun
            }
        }
    }
   {
        # prevent all sources matching "Chromium" from messing with the volume
        matches = [ { application.name = "~Chromium.*" } ]
        actions = { quirks = [ block-source-volume ] }
     
    }
    {
        matches = [ { application.process.binary = "Discord" } ]
        actions = { quirks = [ block-source-volume ] }
    }
]

if you need to figure a certain application to block, check "pactl list source-outputs" and the application.name (or any other really) property of the offender.

Last edited by V1del (2024-11-15 18:52:09)

Offline

#5 2024-11-15 20:03:18

le_grande_castel
Member
Registered: 2022-05-16
Posts: 10

Re: [SOLVED] How to stop microphone gain from adjusting automatically?

V1del wrote:

Pipewire has a quirk property to disallow applications messing with the source volume (funnily enough it has a commented, literal example for discord in /usr/share/pipewire/pipewire-pulse.conf): Create the section in e.g. /etc/pipewire/pipewire-pulse.d/10-adjustQuirkRules.conf

pulse.rules = [
    {
        matches = [
            {
                # all keys must match the value. ! negates. ~ starts regex.
                #client.name                = "Firefox"
                #application.process.binary = "teams"
                #application.name           = "~speech-dispatcher.*"
            }
        ]
        actions = {
            update-props = {
                #node.latency = 512/48000
            }
            # Possible quirks:"
            #    force-s16-info                 forces sink and source info as S16 format
            #    remove-capture-dont-move       removes the capture DONT_MOVE flag
            #    block-source-volume            blocks updates to source volume
            #    block-sink-volume              blocks updates to sink volume
            #quirks = [ ]
        }
    }
    {
        # skype does not want to use devices that don't have an S16 sample format.
        matches = [
             { application.process.binary = "teams" }
             { application.process.binary = "teams-insiders" }
             { application.process.binary = "skypeforlinux" }
        ]
        actions = { quirks = [ force-s16-info ] }
    }
    {
        # firefox marks the capture streams as don't move and then they
        # can't be moved with pavucontrol or other tools.
        matches = [ { application.process.binary = "firefox" } ]
        actions = { quirks = [ remove-capture-dont-move ] }
    }
    {
        # speech dispatcher asks for too small latency and then underruns.
        matches = [ { application.name = "~speech-dispatcher.*" } ]
        actions = {
            update-props = {
                pulse.min.req          = 512/48000      # 10.6ms
                pulse.min.quantum      = 512/48000      # 10.6ms
                pulse.idle.timeout     = 5              # pause after 5 seconds of underrun
            }
        }
    }
   {
        # prevent all sources matching "Chromium" from messing with the volume
        matches = [ { application.name = "~Chromium.*" } ]
        actions = { quirks = [ block-source-volume ] }
     
    }
    {
        matches = [ { application.process.binary = "Discord" } ]
        actions = { quirks = [ block-source-volume ] }
    }
]

if you need to figure a certain application to block, check "pactl list source-outputs" and the application.name (or any other really) property of the offender.

Thanks, seems to work now!

Offline

#6 2024-11-16 00:01:49

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,319

Re: [SOLVED] How to stop microphone gain from adjusting automatically?

Great, please mark as [SOLVED] by editing the title in your first post (might have to shorten a bit)

Offline

Board footer

Powered by FluxBB