Created
September 10, 2018 07:18
-
-
Save jaegonlee/7575a0c3ceaa6eb8064b3bb5915a6f6f to your computer and use it in GitHub Desktop.
Revisions
-
jaegonlee created this gist
Sep 10, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ import processing.sound.*; AudioIn input; FFT fft; //float smoothingFactor = 0.2; float[] sum = new float[128]; public void setup() { size(512, 360); background(255); input = new AudioIn(this, 0); input.start(); fft = new FFT(this, 128); fft.input(input); } public void draw() { background(125, 255, 125); fill(255, 0, 150); noStroke(); fft.analyze(); for (int i = 0; i < 128; i++) { //sum[i] += (fft.spectrum[i] - sum[i]) * smoothingFactor; sum[i] = fft.spectrum[i]; rect(i*4, height, 4, -sum[i]*height); } }