I was doing an "live-audio-visualizer" in Processing. Everything is working fine except of this:
Even if I don't play any music/sound in the background my program shows that there is sound. I don't know why this happens..
Here's my code:
import ddf.minim.analysis.*;
import ddf.minim.*;
Minim minim;
AudioInput in;
int buffer_size = 512;
float sample_rate = 44100;
FFT fft;
void setup()
{
size(480, 600);
minim = new Minim(this);
in = minim.getLineIn(Minim.MONO,buffer_size,sample_rate);
fft = new FFT(in.bufferSize(), in.sampleRate());
fft.window(FFT.HAMMING);
}
void draw()
{
background(0);
stroke(255);
fft.forward(in.mix);
for(int i = 0; i < fft.specSize(); i++)
{
ellipse(i, 300, 1, fft.getBand(i) * 100);
}
float current = fft.getBand(0) * 100;
stroke(255, 0, 0);
rect(200, 300, 20, -current);
}
Edit: By now I played around a bit and found out, that I'm analyzing the output and the input, but i just want the output.. how can I do that?