How to smooth out frequencies while using fft for visualization?

How can I smooth out frequencies to eliminate extra vibrations while processing a sound wave using minim and processing? Kindly check out this 3d visualizer demo video, I’m working on, for reference.

Without seeing your code it is hard to know what you are using.

If you want to implement your own simple smoothing feature, you can use lerp()

Here is a simple example:

 * Simple smoother
 * Processing 3.4 - 2019-01-29
 * see

float[] target;
float[] display;
float sensitivity = 0.5;
int count = 10;
float span;

void setup(){
  target = new float[count];
  display = new float[count];
  span = width/(float)count;

void draw(){
  // generate random targets
  for(int i=0; i<count; i++){
    target[i] = random(height);
  // update smoothing sensitivity
  sensitivity = constrain(mouseX/(float)width, 0.01, .99);
  // update bar display values and draw
  for(int i=0; i<count; i++){
    display[i] = lerp(display[i], target[i], 1-sensitivity);
    rect(i*span, 0, span, display[i]);

1 Like

Thank you for your response, to get those beats I’m iterating over fft.getBand() method. Following is the over simplified version or logic of my code.

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

FFT fft;
AudioPlayer player;
Minim minim;

void setup() {
   minim = new Minim(this);
   player = minim.loadFile("D:/test.mp3");;
   fft = new FFT(player.bufferSize(), player.sampleRate());

void draw() {

   for (int i=0; i<24; i++) {

      box(50, -fft.getBand(i)*5 , 50);   //from here cubes transform accordingly


1 Like
  • An approach is to smooth each band over time, individually from each other.

  • Run the code the first time so you collect all the frequency bands over time.

  • You take every frequency band and you smooth it using a low pass filter and store the result.

  • You play the song and instead of using the frequency bands directly from the song, you will use the smoothed version.

In other words, you need to run this algorithm twice. The first time to collect all the data and then you apply the smoothing. The second time would be to display it.

For smoothing, you can do a quick search about low pass filter. A simple smoothing algorithm is window averaging. You take, say, three contiguous band in time, you average them and the resulting value will be the value of the middle band. You get a more smooth signal (meaning less vibration-like pattern as shown in the video) if you use a larger number instead of 3 for averaging.