maybe linear spectrum output is a better idea ..

This commit is contained in:
Ahmet Inan 2015-01-07 18:32:34 +01:00
parent bd0e98ba75
commit fd7326e24a

View file

@ -56,8 +56,12 @@ static void spectrum_analyzer(float amplitude)
spectrum_buffer[spectrum_width * j + i] = spectrum_buffer[spectrum_width * (j-1) + i];
for (int i = 0; i < spectrum_width; ++i) {
int b = (i * (radix2_N / 2)) / spectrum_width;
#if 0
float dB = 20.0f * log10(cabs(output[b]));
float v = min(1.0f, max(0.0f, (60.0f + dB) / 60.0f));
#else
float v = min(1.0f, max(0.0f, pown(cabs(output[b]), 2)));
#endif
spectrum_buffer[i] = rainbow(v);
}
}