circular fft visualizer
@author
import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.ugens.*;
import ddf.minim.effects.*;
Minim minim;
AudioInput in;
FFT fftL, fftR;
float radious = 80;
color c2 = color(255, 255, 100);
color c1 = color(127, 255, 212);
void setup(){
size(640, 640);
minim = new Minim(this);
in = minim.getLineIn(Minim.STEREO, 1024);
fftL = new FFT(in.bufferSize(), in.sampleRate());
fftR = new FFT(in.bufferSize(), in.sampleRate());
}
void draw(){
background(0);
translate(width / 2, height / 2);
fftL.forward(in.left);
fftR.forward(in.right);
stroke(lerpColor(c1, c2, map(in.mix.level(), 0, 0.03, 0, 1)));
strokeWeight(1);
for(int i = 0; i <= fftL.specSize() / 2; i += 2){
float angle = HALF_PI - map(i, 0, fftL.specSize() / 2, 0, PI) ;
float len = fftL.getBand(i) * 30;
line(radious * cos(angle), radious * sin(angle), (radious + len) * cos(angle), (radious + len) * sin(angle));
}
for(int i = 0; i <= fftL.specSize() / 2; i += 2){
float angle = HALF_PI + map(i, 0, fftL.specSize() / 2, 0, PI) ;
float len = fftR.getBand(i) * 30;
line(radious * cos(angle), radious * sin(angle), (radious + len) * cos(angle), (radious + len) * sin(angle));
}
}