Skip to content

Commit

Permalink
remove console logging, divide by the number of entries inside calcIn…
Browse files Browse the repository at this point in the history
…tensity
  • Loading branch information
dalibor-drgon committed Jul 10, 2022
1 parent 698df5d commit ed20043
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var processor = (function() {
cos += buf[i] * Math.cos(angle);
sin += buf[i] * Math.sin(angle);
}
return 20 * Math.log10(Math.sqrt(cos * cos + sin * sin) / len);
return 20 * Math.log10(Math.sqrt(cos * cos + sin * sin) / Math.ceil(len));
}

function calcMean(intensities) {
Expand Down Expand Up @@ -98,7 +98,6 @@ var processor = (function() {
if(prev_intensities.length == 10) {
var mean = calcMean(prev_intensities);
var mse = calcMSE(prev_intensities, mean);
console.log(mean, mse);
if (mse < 1 && mean > -70) {
player.stop();
setRunning(false);
Expand Down

0 comments on commit ed20043

Please sign in to comment.