diff --git a/src/main.cpp b/src/main.cpp index 3156cf0..208b136 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -184,20 +184,15 @@ int __cdecl main(int argc, char* argv[]) compute_fft(fft_input, fft_output); // Normalize output - for (int i = 0; i < (FFT_SIZE / 2); i++) - { - //maximum = max(fft_output[i], maximum); - //fft_output[i] = fft_output[i] / maximum; - if (i < (FFT_SIZE / 4)) // Limit uniform fft size. High frequencys contain nothing interesing. - { - float gain = 50.0f; - float alpha = 0.15f; // "Hidastaa" FFT:n piikkejä - float threshhold = 0.05f; // Alin arvo mikä päästetään shaderille (vähentää "noisea") - float x_t = fft_output[i] * gain; - // Exponential smoothing kaava - // s(t) = alpha*x(t)+(1-alpha)*s(t-1) - fft_uniform[i] = (x_t < threshhold) ? 0.f : alpha*(x_t) + (1-alpha)*fft_uniform[i]; - } + for (int i = 0; i < (FFT_SIZE / 4); i++) + { + float gain = 50.0f; + float alpha = 0.15f; // "Hidastaa" FFT:n piikkejä + float threshhold = 0.05f; // Alin arvo mikä päästetään shaderille (vähentää "noisea") + float x_t = fft_output[i] * gain; + // Exponential smoothing kaava + // s(t) = alpha*x(t)+(1-alpha)*s(t-1) + fft_uniform[i] = (x_t < threshhold) ? 0.f : alpha*(x_t) + (1-alpha)*fft_uniform[i]; } syncs[0] = (float)playCursor / (SU_SAMPLE_RATE * SU_CHANNEL_COUNT * SU_SAMPLE_SIZE); // Aika sekunteina.