let bass_circle_size, bass_circle_x, bass_circle_y;
let lowMid_circle_size, lowMid_circle_x, lowMid_circle_y;
let mid_circle_size, mid_circle_x, mid_circle_y;
let highMid_circle_size, highMid_circle_x, highMid_circle_y;
let treble_circle_size, treble_circle_x, treble_circle_y;
let colors = ['#F8B195', '#F67280', '#C06C84', '#6C5B7B', '#355C7D'];
let songName = "Bad Apple!!";
song = loadSound('badapple.mp3');
bass_circle_size = lowMid_circle_size = mid_circle_size = highMid_circle_size = treble_circle_size = 30;
lowMid_circle_x = width*2/6;
mid_circle_x = width*3/6;
highMid_circle_x = width*4/6;
treble_circle_x = width*5/6;
bass_circle_y = lowMid_circle_y = mid_circle_y = highMid_circle_y = treble_circle_y = height/2;
songDuration = song.duration();
songNameColor = color(255);
let spectrum = fft.analyze();
let bass = fft.getEnergy("bass");
let lowMid = fft.getEnergy("lowMid");
let mid = fft.getEnergy("mid");
let highMid = fft.getEnergy("highMid");
let treble = fft.getEnergy("treble");
bass_circle_size = map(bass, 0, 255, 50, 300);
lowMid_circle_size = map(lowMid, 0, 255, 50, 250);
mid_circle_size = map(mid, 0, 255, 50, 200);
highMid_circle_size = map(highMid, 0, 255, 50, 150);
treble_circle_size = map(treble, 0, 255, 50, 100);
bass_circle_x = width/2 + cos(angle) * 300;
bass_circle_y = height/2 + sin(angle) * 200;
lowMid_circle_x = width/2 + cos(angle * 2) * 250;
lowMid_circle_y = height/2 + sin(angle * 2) * 150;
mid_circle_x = width/2 + cos(angle * 3) * 200;
mid_circle_y = height/2 + sin(angle * 3) * 100;
highMid_circle_x = width/2 + cos(angle * 4) * 150;
highMid_circle_y = height/2 + sin(angle * 4) * 50;
treble_circle_x = width/2 + cos(angle * 5) * 100;
treble_circle_y = height/2 + sin(angle * 5) * 25;
ellipse(bass_circle_x, bass_circle_y, bass_circle_size, bass_circle_size);
ellipse(lowMid_circle_x, lowMid_circle_y, lowMid_circle_size, lowMid_circle_size);
ellipse(mid_circle_x, mid_circle_y, mid_circle_size, mid_circle_size);
ellipse(highMid_circle_x, highMid_circle_y, highMid_circle_size, highMid_circle_size);
ellipse(treble_circle_x, treble_circle_y, treble_circle_size, treble_circle_size);
currentTime = song.currentTime();
let minutes = floor(currentTime / 60);
let seconds = floor(currentTime % 60);
let milliseconds = floor((currentTime % 1) * 1000);
let timeString = `${minutes}:${padZero(seconds)}:${padZero(milliseconds, 3)}`;
text(timeString, width/2, height - 20);
songNameColor = lerpColor(songNameColor, color(random(colors)), 0.025);
text(songName, width - 20, 40);
if (millis() - startTime > 5000 && !song.isPlaying()) {
function padZero(num, size = 2) {
let s = "000000000" + num;
return s.substr(s.length - size);