/* * Reduces ringing artifacts from a sample * after backwards Fourier transform. (The * outcome doesn't actually sound very nice, * though.) */ void eliminate_ringing (float *data, uint32_t nframes) { uint32_t i; float x, *x2, x3; for (i = 0; i < nframes; ++i) { x = data[i]; if (i + 2 < nframes) { x2 = &data[i + 1]; x3 = data[i + 2]; } else if (i + 1 < nframes) { x2 = &data[i + 1]; x3 = data[0]; } else { x2 = &data[0]; x3 = data[1]; } if (x <= *x2) { if (*x2 > x3) { *x2 = x; } } else if (*x2 < x3) { *x2 = x; } } }