Skip to content

Commit

Permalink
Bugfix: PitchDetection returning the wrong pitch (#187)
Browse files Browse the repository at this point in the history
When converted to the current syntax, the operation was the wrong way around.
See https://github.com/marl/crepe/blob/gh-pages/crepe.js#L141 for the original.
  • Loading branch information
meiamsome authored and cvalenzuela committed Sep 17, 2018
1 parent eb67ad7 commit c73d1aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PitchDetection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class PitchDetection {
const productSum = products.dataSync().reduce((a, b) => a + b, 0);
const weightSum = weights.dataSync().reduce((a, b) => a + b, 0);
const predictedCent = productSum / weightSum;
const predictedHz = 10 * ((predictedCent / 1200.0) ** 2);
const predictedHz = 10 * (2 ** (predictedCent / 1200.0));

const frequency = (confidence > 0.5) ? predictedHz : null;
this.frequency = frequency;
Expand Down

0 comments on commit c73d1aa

Please sign in to comment.