xxxxxxxxxx
let sound;
let amplitude;
let index = 0;
function preload() {
sound = loadSound("lana del rey video games.mp3");
}
function setup() {
createCanvas(windowWidth, windowHeight);
background(277, 199, 221);
amplitude = new p5.Amplitude();
sound.loop();
}
function draw() {
//if (sound.isPlaying()) {
let level = amplitude.getLevel();
let peak = map(level, 0, 1, 0, height);
stroke(0);
ellipse(index, 0, 5, peak);
if (index < width)
index += 2;
else
index = 0;
//}
}
/*
function mousePressed() {
sound.play();
}
*/