How to make fft into a circle

Hello! Is there a way to make this fft into a circle? Or other cool shape?

import processing.sound.*;

SoundFile file1;

FFT fft;
FFT fft2;
int bands = 128;
float smoothingFactor = 0.2;
float []sum = new float [bands];
int scale = 5;
float barWidth;

void setup() {
  fullScreen();

  barWidth = width/float(bands);

  file1 = new SoundFile(this, "song.mp3");  
  file1.play();
  fft2 = new FFT(this, bands);
  fft2.input(file1);
}

void draw() {
  background(255);

  fft2.analyze();
  pushMatrix();
  translate(width/2, height/2-1100);
  //beginShape();
  for (int i = 0; i < bands; i++) {
    sum[i] += (fft2.spectrum[i] - sum[i]) * smoothingFactor;
    ellipse(i*barWidth, height, barWidth, -sum[i]*height*scale);
  }
  //endShape();
  popMatrix();
}

1 Like

Check these two:

The second is a YT video from Daniel explaining the concept.

EDIT:

Kf

Thanks for responding so soon! Do you know of any examples that are not in p5.js? I am very new to processing and have not branched out to anything else yet.

The first three are Processing java. If you don’t understand any of the concepts, start with simpler sketches. Have a look at the provided examples that come with Processing as well as these tutorials:

https://processing.org/tutorials/

I recommend the 2D transformations.

Kf

The first three are not all processing java. The first one is primarily p5.js and the second one is a p5.js video. Thanks anyway.