xxxxxxxxxx
var sound, amp;
var s = 100;
function preload() {
sound = loadSound('sound.mp3');
}
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
sound.play();
amp = new p5.Amplitude();
}
function draw() {
background(0);
fill(255);
translate(width/2, height/2);
//get Amplitude
var level = amp.getLevel();
s = level * 200;
//decrease the circle size till 0
s = s - 1;
if (s <= 0) {
s = 0;
}
ellipse(0,0,s,s);
}