Interactive Authoring Visual Music

Song used is “The Adventure Line” from the Stanley Parable.


import ddf.minim.*;

import ddf.minim.analysis.*;

Minim minim;
AudioPlayer song;
FFT fft;

void setup()
{
size(512, 200);
minim = new Minim(this);
song = minim.loadFile(“The Adventure Line.mp3”, 512);
song.play();
fft = new FFT(song.bufferSize(), song.sampleRate());
}

void draw()
{
background(0);
fft.forward(song.mix);

for (int i = 0; i < fft.specSize(); i++)
{
noStroke();

fill (255, 127, 0, 128);
rect(231, height, 50, height – fft.getBand(i)*8);

for (int x = 181; x <= 285; x = x+100) {
fill (255, 0, 0, 128);
rect(x, height, 50, height – fft.getBand(i)*7);
}

for (int x = 131; x <= 335; x = x+200) {
fill (148, 0, 211, 128);
rect(x, height, 50, height – fft.getBand(i)*6);
}

for (int x = 81; x <= 385; x = x+300) {
fill (0, 0, 255, 128);
rect(x, height, 50, height – fft.getBand(i)*5);
}

for (int x = 31; x <= 450; x = x+400) {
fill (0, 255, 0, 128);
rect(x, height, 50, height – fft.getBand(i)*4);
}

}
for (int i = 0; i < song.left.size() – 1; i++)
{

stroke(255, 255, 0);
line(i, 50 + song.left.get(i)*50, i+1, 50 + song.left.get(i+1)*50);
line(i, 150 + song.right.get(i)*50, i+1, 150 + song.right.get(i+1)*50);
}
}

Advertisements
This entry was posted in Interactive Authoring, 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