Difference between revisions of "WebRTC Automatic Gain Control"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m
m
 
(2 intermediate revisions by one user not shown)
Line 7: Line 7:
 
A problem with WebRTC and AGC negatively impacts both Microsoft Windows and Linux users and Chrome in particular abuses WebRTC by denying the end user control over audio gain adjustments.  The WebRTC implementation in Chromium has a forced on user feature called Automatic Gain Control with no option to disable.  It often reduces gain to near mute level.  Google won't allow users to disable the AGC in WebRTC for either Chromium or Chrome.
 
A problem with WebRTC and AGC negatively impacts both Microsoft Windows and Linux users and Chrome in particular abuses WebRTC by denying the end user control over audio gain adjustments.  The WebRTC implementation in Chromium has a forced on user feature called Automatic Gain Control with no option to disable.  It often reduces gain to near mute level.  Google won't allow users to disable the AGC in WebRTC for either Chromium or Chrome.
  
On the system the end user sets their microphone gain to the preferred level using a tool such as [[PulseAudio]] or [[ALSA]].  Then the user witnesses the mic gain level decreasing automatically, the visual indicator slider on the audio control application actually seems to move by itself.  The problem is aggravated when the level is reduced to a point where the microphone sensitivity is far too low to be useful.
+
On the system the end user sets their microphone gain to the preferred level using a tool such as [[PulseAudio]] or [[ALSA]].  Then the user witnesses the mic gain level decreasing automatically, the visual indicator slider on the audio control application actually seems to move by itself.  The problem is aggravated when the level is reduced to a point where the microphone sensitivity is far too low to be useful.  This can [https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/999 render the user inaudible] in video conferencing software like meet.google.com, zoom, and others.
  
 
== Linux: Pulse Audio Hack ==
 
== Linux: Pulse Audio Hack ==
Line 33: Line 33:
  
 
Question: Is there any way to prevent application from changing volume level of my microphone? is discussed on the [[ALSA]] wiki page.
 
Question: Is there any way to prevent application from changing volume level of my microphone? is discussed on the [[ALSA]] wiki page.
 +
 +
=== ALSA Mixder Mic Boost ===
 +
Quoted from the source below:
 +
 +
WebRTC in Chrome applies automatic gain adjustment to microphones. There may be an issue with pulseaudio's microphone mixer default settings since mic volume can trend to zero or maximum during a WebRTC session.
 +
 +
This can render the user inaudible in video conferencing software like meet.google.com, zoom, and others.  This seems to be an issue with microphone gain versus microphone boost.
 +
 +
* https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/999
 +
 +
Applying the change here of setting Mic Boost to zero in alsa mixer settings appears to fix the issue of wild volume swings.
  
  

Latest revision as of 17:42, 31 July 2024

Automatic Gain Control or AGC as it relates to audio input is the system making adjustments on the input level of an audio source, such as a microphone or line input. To prevent excessive audio input and distortion, the AGC is supposed to adjust the input audio to a level that is loud enough, yet below the distortion threshold.

Web Real-Time Communication or WebRTC enables real-time communication capabilities directly within web browsers and mobile applications via JavaScript. It is used in applications like video conferencing and live streaming. It is implemented in examples like Google Voice on Google Chrome and Discord on Google Chrome. WebRTC relies on standard protocols and codecs.

Google Chrome uses WebRTC to enable real-time voice, video, and data communication directly without requiring any additional plugins or software. If and when it works correctly it is supposed to offer integration which provides users with seamless, high-quality communication experiences and developers with a robust platform for building interactive web applications.

A problem with WebRTC and AGC negatively impacts both Microsoft Windows and Linux users and Chrome in particular abuses WebRTC by denying the end user control over audio gain adjustments. The WebRTC implementation in Chromium has a forced on user feature called Automatic Gain Control with no option to disable. It often reduces gain to near mute level. Google won't allow users to disable the AGC in WebRTC for either Chromium or Chrome.

On the system the end user sets their microphone gain to the preferred level using a tool such as PulseAudio or ALSA. Then the user witnesses the mic gain level decreasing automatically, the visual indicator slider on the audio control application actually seems to move by itself. The problem is aggravated when the level is reduced to a point where the microphone sensitivity is far too low to be useful. This can render the user inaudible in video conferencing software like meet.google.com, zoom, and others.

Linux: Pulse Audio Hack

You can use a simple shell script that runs in a loop and continues to correct the microphone input level to where you want it.

First identify your audio input device, it will have text in it like "analog-stereo". Use this command:

pacmd list-sources | grep name

In our example we found our microphone on the device labaled:

name: <alsa_input.usb-Jieli_Technology_SINCO_1120022507050006-00.analog-stereo>

So we include that in our loop and run the following command:

while sleep 0.1; do pacmd set-source-volume alsa_input.usb-Jieli_Technology_SINCO_1120022507050006-00.analog-stereo 90000; done

You will have to replace "alsa_input.usb-Jieli_Technology_SINCO_1120022507050006-00.analog-stereo" with your microphone audio input device.

You will have to adjust "90000" to your preference for audio input level. Note that 65535 corresponds to 100%.

This comes from an askubuntu.com post "How to disable microphone from auto adjusting its input volume" credit to the contributor Rufflewind.

In actual use we have found that although this trick does work, it is not ideal in that you will notice a shutter in the microphone audio. As Google Chrome WebRTC AGC fights with the script the mic level will not be consistent. You can experiment with the sleep delay. You will want to break out of the script when you no longer need to use the microphone.

Linux: ALSA Mixer Configuration

Although some people have discussed a degree of success doing this we have found it had no benefit to Google Chrome WebRTC AGC issues.

Question: Is there any way to prevent application from changing volume level of my microphone? is discussed on the ALSA wiki page.

ALSA Mixder Mic Boost

Quoted from the source below:

WebRTC in Chrome applies automatic gain adjustment to microphones. There may be an issue with pulseaudio's microphone mixer default settings since mic volume can trend to zero or maximum during a WebRTC session.

This can render the user inaudible in video conferencing software like meet.google.com, zoom, and others. This seems to be an issue with microphone gain versus microphone boost.

Applying the change here of setting Mic Boost to zero in alsa mixer settings appears to fix the issue of wild volume swings.