Lane
December 8, 2019, 8:01pm
1
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
Lane
December 8, 2019, 9:22pm
3
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.
kfrajer
December 8, 2019, 10:12pm
4
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
Lane
December 8, 2019, 10:25pm
5
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.