xxxxxxxxxx
23
let mic;
let fft; // the sample a sound formula
function setup() {
createCanvas(400, 400);
mic = new p5.AudioIn();
mic.start();
fft = new p5.FFT();
fft.setInput(mic);
}
function draw() {
background(255);
background(220);
let level = mic.getLevel();
console.log(level);
ellipse(width / 2, height / 2, level * 2000, level * 2000);
if (level > 0.1) {
background(random(255), random(255), random(255));
}
}