fix gain introduced by filtering

This commit is contained in:
Jakob Ketterl 2020-01-09 21:44:36 +01:00
parent 98e227c102
commit 922a5ed607
1 changed files with 3 additions and 1 deletions

View File

@ -294,6 +294,7 @@ Interpolator.prototype.process = function(data) {
};
function Lowpass(interpolation) {
this.interpolation = interpolation;
var transitionBandwidth = 0.05;
this.numtaps = Math.round(4 / transitionBandwidth);
if (this.numtaps % 2 == 0) this.numtaps += 1;
@ -348,7 +349,8 @@ Lowpass.prototype.process = function(input) {
acc += this.delay[index] * this.coefficients[i];
if (isNaN(acc)) debugger;
}
output[oi] = acc;
// gain by interpolation
output[oi] = this.interpolation * acc;
}
return output;
};