xxxxxxxxxx
var mic;
function setup() {
createCanvas(500, 500);
// Create an Audio input
mic = new p5.AudioIn();
mic.start();
}
function draw() {
background(0, 0, 0, 10);
noFill();
stroke(255, 0, 174);
let r = map(mic.getLevel(), 0, 0.7, 0, height);
line(width/1.5 , width/1.5 , 200, r, r); //position x, y, width, height
noFill();
stroke(30, 255, 0);
line(width/1.5 , width/1, 400, r, r); //position x, y, width, height
noFill();
stroke(246, 255, 0);
line(width/4.5 , width/2, 200, r, r); //position x, y, width, height
noFill();
stroke(0, 255, 246);
line(width/1.5 , width/1, 10, r, r); //position x, y, width, height
noFill();
stroke(255, 0, 0);
line(width/2 , width/2, 500, r, r); //position x, y, width, height
//translate(r, 50);
//rotate(r);
}