AudioBuffer.getChannelData outputs half mic's volume in Safari

66 Views Asked by At

I'm designing a simple Volume Unit meter here: https://codesandbox.io/embed/cocky-torvalds-60k4n (which is a minimal adaptation of this: https://github.com/cwilso/volume-meter/)

It works pretty well across browsers, but for some reason the input signal seems to go down by half on Safari: when I try out the script with the mic's volume at max, it usually outputs a Max value between 0.3-0.5 on Chrome/Firefox/Edge, and between 0.1-0.3 on Safari 13. It doesn't seem to be related to my config, since I had another person reproduce the same behavior on their machine.

As far as I can tell, the difference is coming from getChannelData, with Safari producing lower values.

Is anyone familiar with this? Should it be considered a bug, and do you know of any workaround to harmonize the output across browsers?

Ultimately my goal is to provide feedback if the mic volume is too low, but it will be unreliable as long as getChannelData's output is not consistent across browsers, or if there isn't a principled way of re-calibrating Safari's numbers

0

There are 0 best solutions below