Turhaksi jäänyt if ehto pois.

This commit is contained in:
2025-07-15 17:23:03 +03:00
parent 34230e18e5
commit 3cba52f4ae

View File

@ -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<65>
float threshhold = 0.05f; // Alin arvo mik<69> p<><70>stet<65><74>n shaderille (v<>hent<6E><74> "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<65>
float threshhold = 0.05f; // Alin arvo mik<69> p<><70>stet<65><74>n shaderille (v<>hent<6E><74> "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.