xxxxxxxxxx
21
function preload( ){
sound = loadSound("narrator.mp3");
}
function setup( ) {
createCanvas(500, 500);
amplitude = new p5.Amplitude();
sound.play( );
}
function draw( ) {
background(0);
fill(255);
var level = amplitude.getLevel();
var size = map(level, 0, 1, 0, 200);
ellipse(width/2, height/2, size, size);
}
function mouseClicked( ){
sound.stop( );
}