diff --git a/voicegardens/static/voicegardens.js b/voicegardens/static/voicegardens.js index b79b562..8d23058 100644 --- a/voicegardens/static/voicegardens.js +++ b/voicegardens/static/voicegardens.js @@ -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; + } + } +}