Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio recording sample rate seems to be 48kHz instead of 44.1KHz on Windows 10 (Chrome) #187

Open
henon opened this issue Feb 2, 2025 · 1 comment

Comments

@henon
Copy link

henon commented Feb 2, 2025

The docs say that on Windows only a sample rate of 44100 is supported. My experiments and measurements show that the recording sample rate seems to be 48000 samples per second instead.

I use MediaStreamRecorder to record PCM audio with this setup:

        streamRecorder.recorderType = StereoAudioRecorder;
        streamRecorder.mimeType = 'audio/pcm';
        streamRecorder.audioChannels = 1;

When I add up the recorded bytes over time (devided by 2 for 16 bits per sample) I get an average of 48000 samples per second +- some minor difference but it is definitely not 44100.

Could it be that the default recording sample rate has changed in newer OS or browser versions? Or are the docs simply wrong?

@henon henon changed the title Recording sample rate seems to be 48kHz instead of 44.1KHz on Windows 10 (Chrome) Audio recording sample rate seems to be 48kHz instead of 44.1KHz on Windows 10 (Chrome) Feb 2, 2025
@henon
Copy link
Author

henon commented Feb 3, 2025

Here is evidence to support my claim, calculating average sample rate after every received buffer

15:50:19.174 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48070,29)
15:50:19.302 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48069,91)
15:50:19.430 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48070,17)
15:50:19.558 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48069,79)
15:50:19.686 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48069,42)
15:50:19.814 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48069,05)
15:50:19.942 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48069,31)
15:50:20.070 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48068,94)
15:50:20.198 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48068,58)
15:50:20.326 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48068,22)
15:50:20.454 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48067,86)
15:50:20.582 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48067,5)
15:50:20.710 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48067,76)
15:50:20.838 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48068,01)
15:50:20.966 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48067,66)
15:50:21.094 [ 12] D    Received samples Size=12288 (AVG measured sample rate=48067,31)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant