Bug 262759
Summary: | When recording audio, volume of recording diminishes after several seconds | ||
---|---|---|---|
Product: | WebKit | Reporter: | bryce.a.aebi |
Component: | Media | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | Normal | CC: | cdumez, eric.carlson, jer.noble, youennf |
Priority: | P2 | ||
Version: | Safari 16 | ||
Hardware: | Mac (Apple Silicon) | ||
OS: | Unspecified |
bryce.a.aebi
I am recording audio in Safari from a Macbook pro microphone using the following basic code:
const createStream = async () => {
// For iOS Safari, reset to play-and-record to allow mic to work
if ((isIOS || isSafari) && navigator.audioSession) {
navigator.audioSession.type = "play-and-record";
}
const stream = await navigator.mediaDevices.getUserMedia({
video: false,
audio: true,
});
return stream;
};
Without fail, the volume of the audio recording starts out at the expected level and then it diminishes in volume (maybe by more than 50%) after about 5 seconds. This happens both when I record and then play back the audio and also when I run an AnalyserNode on the audio in real time and view the audio data live.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
bryce.a.aebi
Another important detail I've realized -- this only appears to happen when humming a fixed pitch.
If I speak normally into the microphone, all of the audio is picked up as expected.
Alexey Proskuryakov
This sounds like it could be expected effect of noise reduction, does this reproduce with it disabled in macOS GUI?
bryce.a.aebi
Yes, it looks like this was an artifact of noise reduction.
When I change the code to this the issue is resolved:
const stream = await navigator.mediaDevices.getUserMedia({
audio: {
autoGainControl: false,
echoCancellation: false,
noiseSuppression: false,
}
});
Thanks for taking a look
youenn fablet
Marking as WontFix since this is expected behaviour. Please reopen if needed.