MediaStreamRecorder icon indicating copy to clipboard operation
MediaStreamRecorder copied to clipboard

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

Open henon opened this issue 9 months ago • 2 comments

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 avatar Feb 02 '25 17:02 henon

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)

henon avatar Feb 03 '25 14:02 henon

I have also observed this. Opening files from save() in VLC are reported as 48000 in the codec information.

forgedbyte avatar Apr 03 '25 02:04 forgedbyte