Browse Source

Remove pitch for now

main
Luke Murphy 5 years ago
parent
commit
b5bedbf8a1
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 18
      voicegardens/static/voicegardens.js

18
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;
}
}
}

Loading…
Cancel
Save