Hello
I've got an additive synth which generates some very high frequency partials and hence aliasing distortion occurs when the fundamental is high enough.
I tried to fix this by using a low pass (lop~) filter before the dac. This didn't fix the problem and I suspect that lop~ only filters up to about 22kHz. Is there a way of implementing a 'brick wall' filter which will stop ALL frequencies past a cutoff? (i.e. not just frequencies in the audible range)
You can make a 'brick' filter using an FFT transform, but the sound will be more or less altered (depending on the window size and the overlap you use for the FFT). I programmed a dual similar filter for adding the low partials of a sound to the high partials of another sound (the limit is as vertical as possible). As there was nothing else running in the patch, I could set the window size to 4096 (for accurate frequency resolution) and the overlap to 16 (for accurate "time" resolution). The problem of this method is that it takes lots of CPU.
Another solution is to calculate the highest partial that won't produce aliasing, in function of the fundamental. If we call F the fundamental, the k-th partial will have a frequency of F + k*F (if you chose another harmonicity system, you may adapt this formula). Therefore the maximum number of computable partials of the F fundamental is the integer part of (22050-F)/F. For F = 10 Hz, you can compute 2204 partials For F = 1000 Hz, you can only compute 21 partials The idea, here, is to limit the number of partials to the maximum (you can evaluate this maximum in realtime, in function of the fundamental). You can either mute the partials that outpass the limit (the most simple solution) or not even calculate them.
I hope it will help
j