html的recorder.js怎么设置录音的采样率为16kHz
调用百度的语音识别接口,但是百度的语音识别接口是要求音频16bit,16kHz,单声道,在百度查了查按照找到的改了js但是采样率还是没变,各位大佬这个怎么设置采样率 function exportWAV(type) {
// 默认为16k
var desiredSamplingRate = 16000;
var buffers = [];
for (var channel = 0; channel < numChannels; channel++) {
var buffer = mergeBuffers(recBuffers, recLength);
// 需要转换采样率
if (desiredSamplingRate != sampleRate) {
// 插值去点
buffer = interpolateArray(buffer, desiredSamplingRate, sampleRate);
}
buffers.push(buffer);
}
var interleaved = numChannels === 2 ? interleave(buffers, buffers) : buffers;
var dataview = encodeWAV(interleaved, desiredSamplingRate);
var audioBlob = new Blob(, {type: type});
self.postMessage({command: 'exportWAV', data: audioBlob});
} Augus 发表于 2019-12-19 09:17
function exportWAV(type) {
// 默认为16k
...
大佬中间的插值去点的方法能否给份代码,之前网上找的然后写了行不通
页:
[1]