visualizer
parent
904c562d8b
commit
49c7923528
@ -0,0 +1,22 @@
|
||||
let mic, fft;
|
||||
|
||||
function setup() {
|
||||
createCanvas(710, 400);
|
||||
noFill();
|
||||
|
||||
mic = new p5.AudioIn();
|
||||
mic.start();
|
||||
fft = new p5.FFT();
|
||||
fft.setInput(mic);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
background(200);
|
||||
|
||||
let spectrum = fft.analyze();
|
||||
beginShape();
|
||||
for (i = 0; i < spectrum.length; i++) {
|
||||
vertex(i, map(spectrum[i], 0, 255, height, 0));
|
||||
}
|
||||
endShape();
|
||||
}
|
Loading…
Reference in New Issue