From fd7326e24a4059466ba1edca68f9626d1130af21 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Wed, 7 Jan 2015 18:32:34 +0100 Subject: [PATCH] maybe linear spectrum output is a better idea .. --- app/src/main/rs/stft.rsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/rs/stft.rsh b/app/src/main/rs/stft.rsh index 92508aa..2a97fe0 100644 --- a/app/src/main/rs/stft.rsh +++ b/app/src/main/rs/stft.rsh @@ -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); } }