xxxxxxxxxx
var mic;
function setup() {
createCanvas(500, 500);
rectMode(CENTER);
// Create an Audio input
mic = new p5.AudioIn();
mic.start();
}
function draw() {
background(255, 10);
translate(width/2, height/2);
noFill();
stroke(0);
// Get the overall volume (between 0 and 1.0)
// Map to height
let r = map(mic.getLevel(), 0, 0.7, 0, height);
rotate(r/100);
ellipse(0, 0, 100, 200);
rotate(r/100);
ellipse(0, 0, 100, 200);
rotate(r/100);
ellipse(0, 0, 100, 200);
rotate(r/100);
ellipse(0, 0, 100, 200);
}