xxxxxxxxxx
var mic, fft, spectrum, l;
function setup() {
createCanvas(windowWidth, windowHeight);
mic = new p5.AudioIn();
mic.start();
fft = new p5.FFT();
fft.setInput(mic);
angleMode(DEGREES);
}
function draw() {
background(225);
spectrum = fft.analyze();
var i = 0;
for (angle = 0; angle < 360; angle += 360/300) {
l = map(spectrum[i], 0, 255, 0, 500);
noFill();
ellipse(windowWidth/2, windowHeight/2, 600);
line(windowWidth/2, windowHeight/2, windowWidth/2 + l*cos(angle), windowHeight/2 + l*sin(angle));
i += 1
}
}