// Based on example at https://processing.org/reference/libraries/sound/FFT.html import processing.sound.*; SoundFile song; FFT fft; int bands = 512; float[] spectrum = new float[bands]; int scale = 20; void setup() { size(512, 360); background(255); song = new SoundFile(this, "vibraphon.aiff"); song.loop(); fft = new FFT(this, bands); fft.input(song); } void draw() { background(255); fft.analyze(spectrum); for(int i = 0; i < bands; i++){ // The result of the FFT is normalized // draw the line for frequency band i scaling it up to get more amplitude line( i, height, i, height - spectrum[i]*height*scale ); } }