Calculate pitch

This commit is contained in:
Luke Murphy 2020-02-07 12:53:27 +01:00
parent db26aec15f
commit 1aac136c65
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -419,3 +419,14 @@ function windowResized() {
**/
resizeCanvas(windowWidth, windowHeight);
}
function getMaxPitch(spectrum) {
/**
* Get max pitch.
*/
for (let x = spectrum.length - 1; x > 0; x--) {
if (spectrum[x] != 0) {
return x;
}
}
}