public float[] ExtractLogBins(float[] spectrum, int[] logFrequenciesIndex, int logBins, int wdftSize)
{
int width = wdftSize / 2; /* 1024 */
float[] sumFreq = new float[logBins]; /*32*/
for (int i = 0; i < logBins; i++)
{
int lowBound = logFrequenciesIndex[i];
int higherBound = logFrequenciesIndex[i + 1];
for (int k = lowBound; k < higherBound; k++)
{
double re = spectrum[2 * k] / width;
double img = spectrum[(2 * k) + 1] / width;
sumFreq[i] += (float)((re * re) + (img * img));
}
sumFreq[i] = sumFreq[i] / (higherBound - lowBound);
}
return sumFreq;
}