xxxxxxxxxx
value = 0
value1 = 80
var input;
var analyzer;
function setup() {
createCanvas(windowWidth, windowHeight);
background(value);
input = new p5.AudioIn();
input.start();
}
function draw() {
var volume = input.getLevel();
if(0.005>volume){
fill('white')
circle(random(0,windowWidth), random(windowHeight/2,windowHeight/2), random(0,50));
}
else if(0.05>volume>0.01){
fill('pink')
circle(random(0,windowWidth), random(windowHeight/2+200,windowHeight/2+150), random(0,50));
}
else if(0.1>volume>0.05){
fill('blue')
circle(random(0,windowWidth), random(windowHeight/2-200,windowHeight/2-150), random(0,50));
}
else if(0.5>volume>0.1){
fill('green')
circle(random(0,windowWidth), random(windowHeight/2+100,windowHeight/2+100), random(0,50));
circle(random(0,windowWidth), random(windowHeight/2-100,windowHeight/2-100), random(0,50));
}
}