Waveform Beat

Using the Minim Library in Processing, I was able to make this waveform animation with Jazz in Paris by Media Right Productions from the YouTube Audio Library.

This is the code I used:

import ddf.minim.analysis.*;
import ddf.minim.*;

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

float eRadius;

void setup()
{
size(512, 400);
minim = new Minim(this);
song = minim.loadFile(“Jazz_In_Paris.mp3”, 512);
song.play();
beat = new BeatDetect();
}

void draw()
{
background(120,0,120);
beat.detect(song.mix);
float a = map(eRadius,40,115,30,255);
fill(40,120,65,a);
if(beat.isOnset()) eRadius=250;
ellipse(width/2,height/2,eRadius,eRadius);
rectMode(CENTER);
rect (20,height/2,eRadius,50);
rect (width-20,height/2,eRadius,50);
eRadius *= 0.91;
if(eRadius < 20) eRadius=20;
stroke(random(255),random(255),random(255));
for(int i = 0; i < song.bufferSize() – 1; i++)
{
line(i, 50 + song.left.get(i)*50, i+1, 50 + song.left.get(i+1)*50);
line(i, 350 + song.right.get(i)*50, i+1, 350 + song.right.get(i+1)*50);
}
}

Advertisements

About degrafgo

I am a fun, green loving guy who owns 3 YouTube channels under the name DeGraphics.
This entry was posted in Time Based and tagged , , , , , . Bookmark the permalink.

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