Code (FINAL)
My finished code and their respective outputs:
MULTILOVE (By The Mortal Orchestra):
var song; var amp; var volhistory = [];
function setup() { Ā createCanvas(384, 384); Ā angleMode(DEGREES); Ā song = loadSound("tightenup.mp3", loaded); Ā amp = new p5.Amplitude(); }
function loaded() { Ā song.play(); }
function draw() { Ā fill(5, 0, 20); Ā noStroke(); Ā ellipse(192, 192, 384, 384); Ā var vol = amp.getLevel(); Ā volhistory.push(vol);
Ā translate(width / 2, height / 2);
Ā beginShape(); Ā for (var i = 0; i < 1080; i++) { Ā Ā var r = map(volhistory[i], 0, 1, 50, 250); Ā Ā var x = r * cos(i); Ā Ā var y = r * sin(i); Ā Ā vertex(x, y); Ā Ā stroke(20, 0, map(volhistory[i], 0, 1, 100, 250)); Ā } Ā endShape();
Ā beginShape(); Ā for (var i = 0; i < 720; i++) { Ā Ā var r = map(volhistory[i], 0, 1, 50, 200); Ā Ā var x = r * cos(i); Ā Ā var y = r * sin(i); Ā Ā vertex(x, y); Ā Ā stroke(115, 5, map(volhistory[i], 0, 1, 100, 250)); Ā } Ā endShape();
Ā beginShape(); Ā for (var i = 0; i < 360; i++) { Ā Ā var r = map(volhistory[i], 0, 1, 50, 150); Ā Ā var x = r * cos(i); Ā Ā var y = r * sin(i); Ā Ā vertex(x, y); Ā Ā stroke(190, 5, map(volhistory[i], 0, 1, 100, 250)); Ā } Ā endShape();
Ā Ā if (volhistory.length > 1080) { Ā Ā Ā volhistory.splice(0, 1); Ā Ā } }
TIGHTEN UP (By The Black Keys)
var song; var amp; var volhistory = [];
function setup() { Ā createCanvas(384, 384); Ā angleMode(DEGREES); Ā song = loadSound("tightenup.mp3", loaded); Ā amp = new p5.Amplitude(); }
function loaded() { Ā song.play(); }
function draw() { Ā fill(5, 0, 20); Ā noStroke(); Ā ellipse(192, 192, 384, 384); Ā var vol = amp.getLevel(); Ā volhistory.push(vol);
Ā translate(width / 2, height / 2);
Ā beginShape(); Ā for (var i = 0; i < 1080; i++) { Ā Ā var r = map(volhistory[i], 0, 1, 50, 250); Ā Ā var x = r * cos(i); Ā Ā var y = r * sin(i); Ā Ā vertex(x, y); Ā Ā stroke(20, 0, map(volhistory[i], 0, 1, 100, 250)); Ā } Ā endShape();
Ā beginShape(); Ā for (var i = 0; i < 720; i++) { Ā Ā var r = map(volhistory[i], 0, 1, 50, 200); Ā Ā var x = r * cos(i); Ā Ā var y = r * sin(i); Ā Ā vertex(x, y); Ā Ā stroke(115, 5, map(volhistory[i], 0, 1, 100, 250)); Ā } Ā endShape();
Ā beginShape(); Ā for (var i = 0; i < 360; i++) { Ā Ā var r = map(volhistory[i], 0, 1, 50, 150); Ā Ā var x = r * cos(i); Ā Ā var y = r * sin(i); Ā Ā vertex(x, y); Ā Ā stroke(190, 5, map(volhistory[i], 0, 1, 100, 250)); Ā } Ā endShape();
Ā Ā if (volhistory.length > 1080) { Ā Ā Ā volhistory.splice(0, 1); Ā Ā } }














