A new breakthrough! Just implemented a low-pass filter. Check out the attached .tap - first pattern is without the filter, second with low-pass enabled.
The low-pass is implemented with this simple algo:
y[i] = a(x[i] - y[i-1])where y is the actual output volume level, x is the unfiltered output, and a is a (time-related) constant, in this case 0.25. Using a = 0.125 gives better results, but I'd need to implement more volume levels to use it.
I tried implementing a high-pass, too, but so far no luck on that, because the algo for that can produce negative values (unlike the low-pass one where the result will always be >=0). The high-pass algo I have is
y[i] = a(y[i-1] + x[i] - x[i-1]) Any idea how to modify it so it'll always produce positive results? I could probably invert the output but that'd be too slow I think.
EDIT: Nevermind, got it. The current implementation is ugly as hell, but hey, it works ![]()