Record audio on web, preset: 16000Hz 16bit

后端 未结 4 1042
终归单人心
终归单人心 2021-01-05 08:02
function floatTo16BitPCM(output, offset, input){
  for (var i = 0; i < input.length; i++, offset+=2){
    var s = Math.max(-1, Math.min(1, input[i]));
    output.         


        
4条回答
  •  感动是毒
    2021-01-05 08:41

    You can change the init function like this, here you can overcome the default browser sample rate to 16000 and also the channels indicating the mono/stereo we can change that one also , if it is mono it will be 1 , other wise two .

     function init(config) {
                //sampleRate = config.sampleRate;
                sampleRate = 16000;
                debugger;
                //numChannels = config.numChannels;
                numChannels = 1;
                initBuffers();
            }
    

提交回复
热议问题