Alright here's a preliminary of the code — it works! I feel like Minim probably has this natively, but I just couldn't figure it out. If it's not, where could I go to possibly request an addition? Is it on github or something?
The values are all out of whack and completely dissimilar from Sonia, but the Helper works.
Hope it can go to good use. I know I'll be using it!
Code:
import ddf.minim.*;
import ddf.minim.analysis.*;
import SoniaHelper.*;
Minim minim;
AudioInput in;
FFT f;
float l, d;
int s = 256,
n = 8;
float[] spectrum = new float[s];
SoniaHelper fft;
void setup() {
size(512,400);
int s = 256;
int n = 8;
minim = new Minim(this);
in = minim.getLineIn(Minim.STEREO, s);
f = new FFT(in.bufferSize(), in.sampleRate());
minim.debugOn();
fft = new SoniaHelper(s, n, false);
fft.setMaxLimits(0,256);
d = 0.02;
fft.setDamper(d);
}
void draw() {
background(0);
noStroke();
fill(255,255,0);
doSoundInput();
for(int i = 0; i < in.bufferSize(); i++) {
rect( i * (width/256), height, width/256, - width/256 - 250*(fft.spectrum[i]*fft.spectrum[i]) );
}
}
public void doSoundInput() {
f.forward(in.left);
for(int i = 0; i < in.bufferSize(); i++) {
spectrum[i] = 100*f.getBand(i);
}
fft.update(spectrum);
}
void stop() {
in.close();
minim.stop();
super.stop();
}