Yppah – R Mullen (Audio Visualization)

https://vimeo.com/187042388

import ddf.minim.*;

import ddf.minim.analysis.*;

float r;
float g;
float b;
float a;
float rad;
float c;
float d = .1;

boolean click;
boolean space;

Minim minim;
AudioPlayer song;
AudioInput input;
BeatDetect beat;

void setup(){
size(1080,720);
minim = new Minim(this);
song = minim.loadFile(“Yppah – R. Mullen.mp3”, 1000);
song.play();
beat = new BeatDetect();
a = 10;
background(0);
smooth();
}

void draw(){

r = random(255);
g = random(255);
b = random(255);

beat.detect(song.mix);

if(beat.isOnset() ) a = 50; d = 1;
a -= 10;
d -= .1;

if(a <= 5) a = 5;
if(d == .1) d = .1;

stroke(0,g,b,a+30);
for(int i = 0; i < song.bufferSize()-1; i++){
line(540 + song.left.get(i)*540, i, 540 + song.left.get(i+1)*540, i+1);
line(540 + song.right.get(i)*-540, i, 540 + song.right.get(i+1)*-540, i+1);
}

stroke(r,g,0,a);
for(int i = 0; i < song.bufferSize()-1; i++){
line(width + song.right.get(i)*300, i-90, width + song.left.get(i+1)*300, i+90);
line(song.left.get(i)*300, i-90, song.left.get(i+1)*300, i+90);
}

if(space == true){
for(int x = 0; x < width; x += 2){
for(int y = 0; y < height; y += 2){
noStroke();
fill(random(255),random(255),random(255),20);
rect(x,y,2,2);
}
}
}

rad = height/2;
float x = width/2 + cos(c)*rad;
float y = height/2 + sin(c)*rad;
stroke(r,g,b,a+30);
line(width/2,height,x,y);
c += d;

if(click == true){
noStroke();
fill(0,g,b,5);
for(int i = 400; i > 0; i -= 40){
ellipse(mouseX,mouseY,i,i);
}
}
}

void mousePressed(){
click = true;
}

void mouseReleased(){
click = false;
}

void keyPressed(){
space = true;
}

void keyReleased(){
space = false;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s