Hi Processing community, I am trying to recreate the effect from this video (8:28 minutes in) which draw the song amplitude as a continuous animated line. I got to the point where I have dots flying around, but have hard time translate the rest p5 code to Processing, especially have difficulty understanding the volhistory.push(vol) part and splice function. Thanks for helping.
PS: sorry, can’t seem to update .mp3 file here…
import processing.sound.*;
FFT fft;
SoundFile xmas;
int bands = 512;
float[] spectrum = new float[bands];
void setup() {
size(512, 512);
background(255);
xmas = new SoundFile(this, "xmas.mp3");
fft = new FFT(this, bands);
fft.input(xmas);
play();
}
void draw() {
background(255);
fftFunc();
}
void fftFunc() {
fft.analyze(spectrum);
for (int i = 0; i < bands; i++) {
stroke(0);
beginShape();
vertex(i, height - spectrum[i]*height*50);
endShape();
}
}
void play() {
xmas.play();
}
Thank you kll. I figured vertex not connected is the problem. However, I still couldn’t figure out how to make these lines moving forward like it is in the video at 8:28. One thing I did notice, the animated forward moving line is the sound volume of the song in the video not the frequency of the song like we are doing here right? which has 512 bands.