Hey folks, im trying to throw together a quick and dirty little FFT processing patch, that does an FFT on the audio currently being played (so not any loaded mp3 file, we are using another player for that). Im planning on using numbers from this FFT to drive 15 strips of RGB LEDS that I have connected to an Arduino. So basically:

*Listen to system audio

*perform FFT

*send numbers to Arduino

However Im having problems. I hacked the FFT example patch, but nothing is seemingly going on. I try doing an FFT to the current signal(out), and then use the drawing example to visualize it, so I can confirm it is actually working.

Here is my code so far:

- import ddf.minim.analysis.*;
- import ddf.minim.*;
- import ddf.minim.signals.*;
- Minim minim;
- AudioPlayer jingle;
- AudioOutput out;
- AudioInput input;
- FFT fft;
- String windowName;
- void setup()
- {
- size(512, 200, P3D);
- textMode(SCREEN);
- minim = new Minim(this);
- out = minim.getLineOut(Minim.STEREO, 2048);
- // create an FFT object that has a time-domain buffer
- // the same size as jingle's sample buffer
- // note that this needs to be a power of two
- // and that it means the size of the spectrum
- // will be 512. see the online tutorial for more info.
- fft = new FFT(out.bufferSize(), out.sampleRate());
- }
- void draw()
- {
- background(0);
- stroke(255);
- // perform a forward FFT on the samples in jingle's left buffer
- // note that if jingle were a MONO file,
- // this would be the same as using jingle.right or jingle.left
- fft.forward(out.mix);
- for(int i = 0; i < fft.specSize(); i++)
- {
- // draw the line for frequency band i, scaling it by 4 so we can see it a bit better
- line(i, height, i, height - fft.getBand(i)*10);
- }
- fill(128);
- }
- void stop()
- {
- // always close Minim audio classes when you finish with them
- out.close();
- minim.stop();
- super.stop();
- }

=== Minim Error ===

=== Likely buffer underrun in AudioOutput.

This, however should always happen on launch. It should only be an issue if the error is spammed in the output window.

Any help here?

1