xxxxxxxxxx
24
let input;
let analyzer;
function setup() {
createCanvas(400, 400);
mic = new P5.AudioIn();
mic.start();
}
function draw() {
background(220);
arc(100,100,90,90, PI, 2*PI);
// Get the overall volume (between 0 and 1.0)
let vol = mic.getLevel();
fill(255);
stroke(0);
// Draw an ellipse with height based on volume
let h = map(vol, 0, 1, height, 0);
let h = vol * 100;
ellipse(330, 75, h, h);
}