xxxxxxxxxx
171
let song, amp;
let volhistory = [];
function preload() {
song = loadSound('008original.mp3');
}
//mint hsl(147.5, 100%, 90.6%)
//peach 15,100,86
function setup() {
createCanvas(500, 700);
colorMode(HSL);
song.play();
amp = new p5.Amplitude();
}
function draw(){
background(15,100,86);
// background(100);
let vol = amp.getLevel();
noFill();
volhistory.push(vol);
strokeWeight(0.8);
//line 1
stroke(0);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i < width){
let y = map(volhistory[i],0,2,100,-400);
vertex(i, y);
}
}
endShape();
//line 2
// stroke(15,100,86);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i > width && i <width*2){
let y = map(volhistory[i],0,2,150,-350);
vertex(i-width, y);
}
}
endShape();
//line 3
stroke(0);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i > width*2 && i <width*3){
let y = map(volhistory[i],0,2,200,-300);
vertex(i-width*2, y);
}
}
endShape();
//line 4
// stroke(15,100,86);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i > width*3 && i <width*4){
let y = map(volhistory[i],0,2,250,-250);
vertex(i-width*3, y);
}
}
endShape();
//line 5
stroke(0);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i > width*4 && i <width*5){
let y = map(volhistory[i],0,2,300,-200);
vertex(i-width*4, y);
}
}
endShape();
//line 6
// stroke(15,100,86);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i > width*5 && i <width*6){
let y = map(volhistory[i],0,2,350,-150);
vertex(i-width*5, y);
}
}
endShape();
//line 7
stroke(0);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i > width*6 && i <width*7){
let y = map(volhistory[i],0,2,400,-100);
vertex(i-width*6, y);
}
}
endShape();
//line 8
// stroke(15,100,86);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i > width*7 && i <width*8){
let y = map(volhistory[i],0,2,450,-50);
vertex(i-width*7, y);
}
}
endShape();
//line 9
stroke(0);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i > width*8 && i <width*9){
let y = map(volhistory[i],0,2,500,0);
vertex(i-width*8, y);
}
}
endShape();
//line 10
// stroke(15,100,86);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i > width*9 && i <width*10){
let y = map(volhistory[i],0,2,550,50);
vertex(i-width*9, y);
}
}
endShape();
//line 11
stroke(0);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i > width*10 && i <width*11){
let y = map(volhistory[i],0,2,600,100);
vertex(i-width*10, y);
}
}
endShape();
//line 12
// stroke(15,100,86);
beginShape()
for(let i = 0; i < volhistory.length;i++){
if(i > width*11 && i <width*12){
let y = map(volhistory[i],0,2,650,150);
vertex(i-width*11, y);
}
}
endShape();
//ellipse(100,100,200, vol*200);
}