simple optimization to filter

just basic algebra, but I should have noticed this sooner!
This commit is contained in:
Andy Sloane 2016-05-31 18:52:33 -07:00
commit f6113fc6c4

4
xm.js
View file

@ -90,8 +90,8 @@ function filterCoeffs(f_c) {
var e = Math.exp(-wct); var e = Math.exp(-wct);
var c = e * Math.cos(wct); var c = e * Math.cos(wct);
var s = e * Math.sin(wct); var s = e * Math.sin(wct);
var gain = (1 - 2*c + c*c + s*s) / 2; var gain = (1 - 2*c + e*e) / 2;
return [gain, 2*c, -c*c - s*s]; return [gain, 2*c, -e*e];
} }
function updateChannelPeriod(ch, period) { function updateChannelPeriod(ch, period) {