mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.19k stars 22.48k forks source link

Web Dictaphone amplitude fades over time #23774

Closed rsorba closed 1 year ago

rsorba commented 1 year ago

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/MediaStream_Recording_API/Using_the_MediaStream_Recording_API

What specific section or headline is this issue about?

A Sample Application: Web Dictaphone

What information was incorrect, unhelpful, or incomplete?

Hello,

This may not be the correct place to report this bug, but I believe that sound is not being accurately recorded from the microphone in the Web Dictaphone. I found this issue, while I was trying to make my own oscilloscope display using the MediaStream Recording API, but the error shows up in the dicataphone as well so I thought it would be useful to point out here. 1000Hz_files.zip

I found that if a constant tone is played through the computer speakers and recorded through the microphone, the amplitude recorded by the audio stream fades over time to practically nothing. You can reproduce the error using the attached 1000Hz_original.wav file created with Audacity. This sound file is 30s of a constant amplitude tone at 1000 Hz. You can see the amplitude of the oscilloscope fade over time.

When played through the speakers and recorded by the "Web Dictaphone", the recording is given by 1000Hz_recorded_with_dictaphone.ogg. Playing this file you hear the volume fade around 10 seconds, until you can barely hear the tone after 15 seconds.

Obviously this behaviour is not correct. The amplitude should remain constant since nothing is changing. Any thoughts on what bug is causing this behaviour? Is there some sort of normalization or gain happening somewhere that is hidden? I would like to know the answer so I can make an oscilloscope that acurrately displays the sounds in a room.

I appreciate your help.

What did you expect to see?

When a constant amplitude wav is played into the mic, the amplitude of the oscilloscope should stay constant.

Do you have any supporting links, references, or citations?

The Dictaphone: https://mdn.github.io/dom-examples/media/web-dictaphone/

My current oscilloscope implementation that has the same issue, but uses the analyser.getFloatTimeDomainData() function: https://nbobbyproblem.com/SoundVisualizer.html

Do you have anything more you want to share?

I am really struggling to understand why this is happening any any support you can give me is greatly appreciated. If there is a better place to report this buggy behaviour please let me know.

MDN metadata

Page report details * Folder: `en-us/web/api/mediastream_recording_api/using_the_mediastream_recording_api` * MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/MediaStream_Recording_API/Using_the_MediaStream_Recording_API * GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/mediastream_recording_api/using_the_mediastream_recording_api/index.md * Last commit: https://github.com/mdn/content/commit/b4b96be3659802d78540af15369a700cdbe36df3 * Document last modified: 2022-11-28T19:07:17.000Z
sideshowbarker commented 1 year ago

This may not be the correct place to report this bug,

Right — it’s out of scope for this particular issue tracker

If there is a better place to report this buggy behaviour please let me know

If it’s a bug in a particular browser — and it can’t be reproduced in other browsers — then the right place to report it would be in the bug tracker for whatever browser you’re having the problem in.

But if it’s a problem you can reproduce in multiple browsers, then I guess a site such as Stack Overflow would be a good place to post a question about it.

However, since it’s not in scope for this particular issue tracker, I’m going ahead and closing this issue