Hi All,
Here's what Im trying to do: when a song plays, I want a 7-band equalizer to appear except instead of basic rectangles I would like the image "building.jpg" that I have in my data folder to stack on top of each other to create the equalizer bar.
I have tried changing the "rect" to image and then inserting building after the "(" however the equalizer then completely dissapears.
I also cannot figure out how to move the equalizer up so that it fits the grid image "coordinates" that I have created. Right now its at the very bottom of the screen and I need the X-axis to be pushed up about 50px or so.
I'm new to this, be gentle.
Here's my code, thanks.
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
Minim minim;
AudioPlayer Alright;
FFT fft;
//waveform = new WaveformRenderer();
//Alright.addListener(waveform);
PImage brick;
PImage bomb;
PImage coordinates;
PImage building;
int brickX = 70;
int brickY = 720;
float bombX = random(90,120);
float bombY = random(0,250);
void setup (){
size(1100, 720);
smooth();
//Setting Up Minim
minim = new Minim(this);
Alright = minim.loadFile("Alright.mp3", 2048);
Alright.loop();
fft = new FFT(Alright.bufferSize(), Alright.sampleRate());
fft.linAverages(9);
rectMode(CORNERS);
//Initiating Images
brick = loadImage("brick.PNG");
bomb = loadImage("bomballoon.png");
coordinates = loadImage("Coordinates.png");
building = loadImage("building.jpg");
}
void draw(){
background (0);
image (coordinates, 0, 0);
image (bomb,bombX,bombY);
image (brick,brickX,brickY,150,50);
image (brick,brickX,680,150,50);
//image (building, 0, 0);
brickX +=148;
if (brickX == screenWidth){
brickX = 0;
}
fft.forward(Alright.mix);
int w = int(fft.specSize()/7);
for(int i = 1; i < fft.avgSize(); i++)
{
rect( i*w-15, height+20, i*w + w, height - fft.getAvg(i)*25);
}
}
void stop()
{
Alright.close();
minim.stop();
super.stop();
}
1