first post for me here, so first of all hi to all of you
i'm new to processing so let's go with the first question
i'm tryng to make a realtime 3D spectrum analyzer, something like this for those who are not in sound analysis:
i managed to draw a live input spectrum analyzer. now i think i have to repeat the spectrum line along the z axis, each line with the state of the previous one in the previous frame (ok i've been not so clear but i think you understand)
i think i have to use a class, but i've not found a good explanation of how it works.
anyway, this is the code:
Code:
import ddf.minim.*;
import ddf.minim.analysis.*;
import processing.opengl.*;
AudioInput stream;
FFT fft;
void setup()
{
size(800, 800, OPENGL);
Minim.start(this);
stream = Minim.getLineIn(Minim.STEREO);
fft = new FFT(stream.bufferSize(), stream.sampleRate());
}
void draw()
{
background(0);
camera(width, 0, (height/2.0) / tan(PI*60.0 / 360.0), width/2.0, height/2.0, 0, 0, 1, 0);
fft.forward(stream.mix);
stroke(0, 255, 0, 128);
for(int i = 0; i < fft.specSize(); i=i+1)
{
line(i+150, height/2-(fft.getBand(i)*5), i+1+150, height/2-((fft.getBand(i+1)*5)));
}
}
void stop()
{
stream.close();
super.stop();
}
thanks for help