From b5bedbf8a1c2648d8d7001099965dfe5522808be Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Fri, 7 Feb 2020 13:47:52 +0100 Subject: [PATCH] Remove pitch for now --- voicegardens/static/voicegardens.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/voicegardens/static/voicegardens.js b/voicegardens/static/voicegardens.js index 360324c..c8fd5c5 100644 --- a/voicegardens/static/voicegardens.js +++ b/voicegardens/static/voicegardens.js @@ -52,16 +52,12 @@ var shapes = []; // Sound properties var amplitude; var duration; -var fft; -var pitch; function record() { /** * Start recording a sound. **/ if (microphone.enabled) { - fft = new p5.FFT(); - fft.setInput(recorder); setTimeout(recorder.record(recording), recordingTimeout); } } @@ -76,9 +72,6 @@ function stop() { // signal to the draw loop that we should generate a new shape newSoundJustRecorded = true; - // https://p5js.org/reference/#/p5.FFT/analyze - pitch = getMaxPitch(fft.analyze()); - // https://p5js.org/reference/#/p5.SoundFile/getPeaks amplitude = recording.getPeaks(1)[0] * 100; @@ -419,14 +412,3 @@ 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; - } - } -}