Coding: Audio Visuals

 

I used the code below to create the visuals to the Mario song in the video above:

color rando;
boolean cray;

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

Minim minim;
AudioPlayer song;
FFT fft;

void setup(){
size(500, 680);
minim = new Minim(this);
song = minim.loadFile(“MARIO.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++){
stroke (rando);
if (cray = true){
rando = color (random (255), random (255), random(255));
line(width, height, i-150, height – fft.getBand(i)*100);
line(i, height, width, height – fft.getBand(i)*100);
}
}

stroke(2, 73, 253);
for (int i = 0; i < song.left.size() – 1; i++){
stroke(90, 152, 65, 128);
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);
line(i, 200 + song.left.get(i)*50, i+1, 50 + song.left.get(i+1)*50);
stroke(254, 0, 0, 128);
line(i, 300 + song.right.get(i)*50, i+1, 150 + song.right.get(i+1)*50);
}
}

 

 

Advertisements

About nadiaparfait1

I am currently attending Alfred State college. My major is Digital Media and Animation. I create art that expresses my emotions and experiences, incorporated with the knowledge that I obtain from school.
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