Alright I'm sort of new to processing and I've been stuck on this part for quite for time now. What I need done for my project is the mp3 file to match the equalizer. If you guy's could please help me out here I'd appreciate it!
import ddf.minim.*;
import ddf.minim.analysis.*;
Minim minim;
AudioPlayer song;
Column col[];
void setup()
{
size(511, 350);
colorMode(HSB);
noStroke();
smooth();
initColumns();
minim = new Minim(this);
song = minim.loadFile("burning.mp3", 512);
song.play();
}
void draw()
{
background(175, 59, 46);
for (int i = 0; i < col.length; i++)
{
col[i].toCanvas();
}
}
void stop()
{
song.close();
minim.stop();
super.stop();
}
void initColumns()
{
col = new Column[18];
int current_x = 0;
for (int i = 0; i < col.length; i++)
{
col[i] = new Column(current_x + 2, 0, 26, height);
current_x += 30;
}
}
class Column
{
int w;
int h;
int xPos;
int yPos;
int rect_h;
int rect_yPos;
color rect_c;
public Column(int _xPos, int _yPos, int _w, int _h)
{
this.xPos = _xPos;
this.yPos = _yPos;
this.w = _w;
this.h = _h;
this.rect_h = this.h / 25;
this.rect_yPos = this.h / 2;
this.rect_c = color(24, 247, 247);
}
public void toCanvas()
{
fill(updateBackgroundColor());
rectMode(CORNER);
rect(xPos, yPos, w, h);
addInteractiveRectangle();
}
private void addInteractiveRectangle()
{
fill(rect_c);
rectMode(CENTER);
rect(xPos + w/2, rect_yPos, w, rect_h);
}
private color updateBackgroundColor()
{
int c = (int) map(this.rect_yPos, 100, this.h, 0, 100);