Skip to content

Commit 3d6c69d

Browse files
authored
Merge pull request #90 from mingzhi22/master
fix: 降采样后的文件有噪声
2 parents 7f29910 + dbd4ce3 commit 3d6c69d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

speech-to-text/webaudio-l16-stream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ WebAudioL16Stream.prototype.downsample = function downsample(bufferNewSamples) {
114114
var nOutputSamples = Math.floor((buffer.length - filter.length) / samplingRateRatio) + 1;
115115
var outputBuffer = new Float32Array(nOutputSamples);
116116

117-
for (i = 0; i + filter.length - 1 < buffer.length; i++) {
117+
for (i = 0; i < outputBuffer.length; i++) {
118118
offset = Math.round(samplingRateRatio * i);
119119
var sample = 0;
120120
for (var j = 0; j < filter.length; ++j) {

0 commit comments

Comments
 (0)