xxxxxxxxxx
var mic;
function setup() {
createCanvas(500, 500);
// Create an Audio input
mic = new p5.AudioIn();
mic.start();
}
function draw() {
background(18, 255, 0, 10);
noFill();
stroke(44, 170, 34);
let r = map(mic.getLevel(), 0, 0.7, 0, height);
triangle(width/2 , width/2, 400, 70, 40, r, r); //position x, y, width, height
noFill();
stroke(240, 255, 0);
triangle(width/3 , width/3, 500 , 60, 40, r, r); //position x, y, width, height
//translate(r, 50);
//rotate(r);
}