Microphone Gain on Safari/MacOS

The microphone gain for our app running on Safari/MacOS is substantially lower than with other browsers. What might account for that and what is the preferred method for a web app to control microphone gain.

Answered by Engineer in 892009022

Safari on macOS enables echoCancellation by default as part of its WebKit audio processing. When echoCancellation is active, any other apps recording audio concurrently can experience a significantly reduced input volume -- this is a known WebKit behavior. However, your own app should still be receiving a normal input level regardless.

A couple of clarifying questions that would help narrow this down:

  • Is echoCancellation enabled? (either explicitly or left at its default) in your getUserMedia constraints?
  • Is the low volume observed within your app itself, or are you noticing it in other apps recording at the same time?

FYI you might be able to work around this by turning off echoCancellation which is the suggestion I got on this somewhat similar bug: https://bugs.webkit.org/show_bug.cgi?id=294623

Safari on macOS enables echoCancellation by default as part of its WebKit audio processing. When echoCancellation is active, any other apps recording audio concurrently can experience a significantly reduced input volume -- this is a known WebKit behavior. However, your own app should still be receiving a normal input level regardless.

A couple of clarifying questions that would help narrow this down:

  • Is echoCancellation enabled? (either explicitly or left at its default) in your getUserMedia constraints?
  • Is the low volume observed within your app itself, or are you noticing it in other apps recording at the same time?

Thanks for the replies. This is a music app, so getUserMedia for our music recordings disables echo cancellation on a DataChannel. We also have WebRTC running RTP for video content at the same time. Perhaps WebRTC's enablement of EC is interfering??? We have not observed this behavior for other web apps.

WebRTC is implemented by WebKit for Safari, which enables echoCancellation by default. Try explicitly setting it to false in your getUserMedia constraints and see if that resolves the issue.

As for other web apps not exhibiting this behavior, they likely already set echoCancellation: false explicitly in their constraints, which would explain the difference.

Microphone Gain on Safari/MacOS
 
 
Q