Hi,
I am new to OF and Audio Analysis and I have a question in regards of the FFT Example:
In the OF example you can find the following in the setup:
// the fft needs to be smoothed out, so we create an array of floats
// for that purpose:
fftSmoothed = new float[8192];
for (int i = 0; i < 8192; i++){
fftSmoothed[i] = 0;
}
nBandsToGet = 128;
This array is initialized with 0 for the 8192 elements for the purpose of smoothing the FFT. Next we set the bands that we want to request from the FFT each update() which is 128 or 1/64 of 8192.
Later we have the following loop to do so
// (5) grab the FFT, and put in into a "smoothed" array,
// by taking maximums, as peaks and then smoothing downward
float * val = ofSoundGetSpectrum(nBandsToGet); // request 128 values for fft
for (int i = 0;i < nBandsToGet; i++){
// let the smoothed calue sink to zero:
fftSmoothed[i] *= 0.96f;
// take the max, either the smoothed or the incoming:
if (fftSmoothed[i] < val[i]) fftSmoothed[i] = val[i];
}
I don´t know what I am overlooking but why do we init 8192 Elements in the setup, but always cycle only through the first 128 (nBandsToGet)? The smoothing happens basically in the loop of the 128 bands but how are the 8192 used or used for smoothing?
Many thanks.