mirror of
https://github.com/xdsopl/robot36.git
synced 2026-01-04 15:29:59 +01:00
maybe linear spectrum output is a better idea ..
This commit is contained in:
parent
bd0e98ba75
commit
fd7326e24a
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue