Remove pitch for now
This commit is contained in:
parent
e9c29c777a
commit
b5bedbf8a1
@ -52,16 +52,12 @@ var shapes = [];
|
|||||||
// Sound properties
|
// Sound properties
|
||||||
var amplitude;
|
var amplitude;
|
||||||
var duration;
|
var duration;
|
||||||
var fft;
|
|
||||||
var pitch;
|
|
||||||
|
|
||||||
function record() {
|
function record() {
|
||||||
/**
|
/**
|
||||||
* Start recording a sound.
|
* Start recording a sound.
|
||||||
**/
|
**/
|
||||||
if (microphone.enabled) {
|
if (microphone.enabled) {
|
||||||
fft = new p5.FFT();
|
|
||||||
fft.setInput(recorder);
|
|
||||||
setTimeout(recorder.record(recording), recordingTimeout);
|
setTimeout(recorder.record(recording), recordingTimeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,9 +72,6 @@ function stop() {
|
|||||||
// signal to the draw loop that we should generate a new shape
|
// signal to the draw loop that we should generate a new shape
|
||||||
newSoundJustRecorded = true;
|
newSoundJustRecorded = true;
|
||||||
|
|
||||||
// https://p5js.org/reference/#/p5.FFT/analyze
|
|
||||||
pitch = getMaxPitch(fft.analyze());
|
|
||||||
|
|
||||||
// https://p5js.org/reference/#/p5.SoundFile/getPeaks
|
// https://p5js.org/reference/#/p5.SoundFile/getPeaks
|
||||||
amplitude = recording.getPeaks(1)[0] * 100;
|
amplitude = recording.getPeaks(1)[0] * 100;
|
||||||
|
|
||||||
@ -419,14 +412,3 @@ function windowResized() {
|
|||||||
**/
|
**/
|
||||||
resizeCanvas(windowWidth, windowHeight);
|
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…
Reference in New Issue
Block a user