Changing sample rate, Web Audio API, getUserMedia

1,212 views
Skip to first unread message

Shiming He

unread,
Jan 9, 2013, 10:18:03 PM1/9/13
to chromiu...@chromium.org
Dear Community,

I'm working on a project that uses Web Audio API and getUserMedia to capture microphone input and POST it to the server via HTTP. In this particular project I might not be able to use a media server to accept WebRTC connections directly. The 'Recorderjs' project (https://github.com/mattdiamond/Recorderjs) did a great job in recording and producing a wave file. However the recorded file format is locked to 44khz - stereo - 16bit (the default audio context format) which is boatload of data. My app only needed 16khz - mono - 16bit format.

Later on I discovered it's not possible to change the sample rate of `webkitAudioContext`. It looks like `OfflineAudioContext` accepts format argument when created (though this function is yet to be exposed to Javascript). But in the discussion here: https://github.com/mattdiamond/Recorderjs/issues/11 , Chris Wilson pointed out that eventually it might not be possible to connect microphone input to OfflineAudioContext because it's not designed for realtime recording.

So it looks like I'm stuck with writing an interpolation algorithm to downsample before sending.

Is it true? Is it not possible to record in 16khz? 

Best regards,
He Shiming
Reply all
Reply to author
Forward
0 new messages