Audio recording using RecordRTC: Blob Size Difference Between Android and Windows on Chrome

58 Views Asked by At

I use RecordRTC library and have an issue related to ondataavailable function and its 'blob' argument size. Here is the snippet of my code:

        recorder = RecordRTC(microphone, {
            recorderType: StereoAudioRecorder,
            type: 'audio/wav',
            mimeType: 'audio/webm;codecs=pcm',
            numberOfAudioChannels: 1,
            bufferSize: 1024,
            desiredSampRate: 8000,
            timeSlice: 40,
            ondataavailable: function(blob) {
                document.getElementById('print').innerHTML += ' ' + blob.size
                //...
            }
        }

When I run this code on Windows 10 Chrome browser I have such a list of blob.sizes:

726 726 726 726 1068 726 1068 726 1068 726 726 726 1068 726 1068 726 1068 726 1068 726 726 1068 726 726 1068 726 726 1068 726 726 1068 726 726 1068 726 726 1068 726 726 1068 1068 726 726 1068 726 1068 1068 386 1410 726 726 1068 726 726 726 1068 1068 726 726 1068 726

When I run the same code using Android Chrome browser I have another list of blob.sizes:

8236 2434 2774 2774 2774 2774 2774 1410 1410 2774 2774 2774 2774 2774 2774 2092 726 2774 2774 2774 2774 2774 2774 2774 2434 2774 2774 2774 2774 1410 1410 2774 2774 2774 2774

This leads to almost unrecognizable sound quality at the server side, where I send this data.

Setting the timeSlice as 100 or 20 yields the same results: on Android, values are close to 2000-2800 bytes.

Please help me either have the same size values or explain how to deal with Android-related data.

Thanks in advance.

0

There are 0 best solutions below