From f6113fc6c4b19cf95b4f3ccd0f7278905f7a3077 Mon Sep 17 00:00:00 2001 From: Andy Sloane Date: Tue, 31 May 2016 18:52:33 -0700 Subject: [PATCH] simple optimization to filter just basic algebra, but I should have noticed this sooner! --- xm.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xm.js b/xm.js index 49c00da..e29bfb5 100644 --- a/xm.js +++ b/xm.js @@ -90,8 +90,8 @@ function filterCoeffs(f_c) { var e = Math.exp(-wct); var c = e * Math.cos(wct); var s = e * Math.sin(wct); - var gain = (1 - 2*c + c*c + s*s) / 2; - return [gain, 2*c, -c*c - s*s]; + var gain = (1 - 2*c + e*e) / 2; + return [gain, 2*c, -e*e]; } function updateChannelPeriod(ch, period) {