xxxxxxxxxx
let sound;
let amplitude;
let index = 0;
function preload() {
sound = loadSound("runaway_aurora.mp3"); //sound
}
function setup() {
createCanvas(windowWidth*2, windowHeight);
background(0); //Bg colour
amplitude = new p5.Amplitude();
sound.loop();
}
function draw() {
//if (sound.isPlaying()) {
let level = amplitude.getLevel();
let peak = map(level, 2, 1, 0, height*1.5);
fill (100, 63, 174);
stroke(0);
ellipse(index, 0, index, peak); //form
if (index < width)
index += 2;
else
index = 0;
//}
}
/*
function mousePressed() {
sound.play();
}
*/