import ddf.minim.*; import ddf.minim.analysis.*; Minim minim; AudioPlayer song; FFT fft; int nFreqBand = 30; void setup() { size(514, 200); minim = new Minim(this); song = minim.loadFile("song.mp3", 512); fft = new FFT(song.bufferSize(), song.sampleRate()); song.play(); colorMode(HSB); //The 30th band has a center frequency of 2497.8516 Hz //println(fft.indexToFreq(nFreqBand-1)); noStroke(); } void draw() { fill(0, 30); rect(0, 0, width, height); // first perform a forward fft on one of song's buffers // I'm using the mix buffer // but you can use any one you like fft.forward(song.mix); for (int i = 0; i < nFreqBand; i++) { fill(i*255/nFreqBand, 255, 255); rect(i*width/nFreqBand, height, width/nFreqBand, height - fft.getBand(i)*10); } }