IA: Minum Practice

Shelby Derck                                                                                                    Oct 6 2016Processing Code:

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

Minim minim;
AudioPlayer song;
FFT fft;
BeatDetect beat;

float eRadius;
int XE=20,YE=100;
int spaceing=40;
void setup()
{
size(512, 200,P3D);

minim = new Minim(this);

song = minim.loadFile(“Achy Breaky Heart.mp3”, 512);
song.play();

fft = new FFT(song.bufferSize(), song.sampleRate());

beat = new BeatDetect();
ellipseMode(RADIUS);
eRadius = 10;
}

void draw()
{
background(0);
fft.forward(song.mix);
//fft——————————————————————————–
for(int i = 0; i < fft.specSize(); i++)
{
//lowlines————————————————————————-
stroke(0, 0, 255, 50);
line(i+XE, width/2, i, height/2 – fft.getBand(i)*50);
line(256+i, height/2 – fft.getBand(i)*50, 256+i+XE, width/2);
//error——————————————————————————-
// flipHalf();//Credited to amnon.owed from forum.processing.com
//error—————————————————————————–
//stroke(255, 0, 0, 50);
//line(i+XE, height, i, height – fft.getBand(i)*50);
//line(i+XE, height+XE, i, height – fft.getBand(i)*50);
// stroke(0,0,255,50);
//line(width/2+XE*2, height, 512, height – fft.getBand(i)*50);
//CenterLines————————————————————————–
stroke(255, 0, 0, 50);
line(height+XE, i+XE, i, height – fft.getBand(i)*50);
line( i, height – fft.getBand(i)*50,height+XE, i+XE);
stroke(0,255,0,50);
line(height+XE, i+XE, 512, height – fft.getBand(i)*50);
line( 512, height – fft.getBand(i)*50,height+XE, i+XE);
//rects——————————————————————————
rectMode(CENTER);
stroke(random(255),random(255),random(255));
fill(255,0,0);

rect(i+150, height+80, i/30, height – fft.getBand(i)*100);

rect(i+350, height+80, i/30, height – fft.getBand(i)*100);

rect(i+250, height+80, i/30, height – fft.getBand(i)*100);

rect(i+50, height+80, i/30, height – fft.getBand(i)*100);
rect(i-150, height+80, i/30, height – fft.getBand(i)*100);

}
//Beat——————————————————————————
beat.detect(song.mix);
float a = map(eRadius, 20, 80, 60, 255);
fill(60, 255, 0, a);
if ( beat.isOnset() ) eRadius = 20;
for (int XE=20; XE<480 ; XE=XE+spaceing){
for(int YE=100;YE<150 && YE>50; YE=YE+10){
ellipse(XE,YE + song.left.get(YE)*50, eRadius, eRadius);
eRadius *= 0.50;
if ( eRadius < 10 ) eRadius = 20;
}
}
//Waveform—————————————————————————-
stroke(random(255),random(255),random(255));
for(int i = 0; i < song.left.size() – 1; i++)
{
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);
point(i*50,i*50);
ellipse(i,0,10+song.left.get(i)*random(100), 10 + song.right.get(i)*random(100));
}
//fft———————————————————————————
for(int t = 0; t < fft.specSize(); t++){
stroke(0,255,0,50);
//line(height+XE, t+XE,height – fft.getBand(200)*50,t);
// line( height – fft.getBand(t)*50, t ,t+XE, height+XE);
//line( height – fft.getBand(t)*50, t ,t+XE, height+XE);

}
//—————————————————————————————-
//saveFrame(“Song/##.png”);
}
//error—————————————————————————–
//void flipHalf() {
// loadPixels();
//for (int x=width/2; x<width; x++) {
// for (int y=0; y<height; y++) {
// pixels[x+y*width] = pixels[(width-x)+y*width];
// }
// }
// updatePixels();
//}//Credited to amnon.owed from forum.processing.com

//Song Credit: Billy Ray Cyrus,”Achy Breaky Heart.” Some gave all, Mercury Records , January 1992.

Advertisements

About dercks

Shelby is a student at Alfred State College in Digital Media and Animation.
This entry was posted in Interactive Authoring, Timebased 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