Best type of filter to use for Anti-Aliasing? | FX Book Questions | Forum


Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Best type of filter to use for Anti-Aliasing?
New Member
May 20, 2018 - 12:34 pm
Member Since: May 20, 2018
Forum Posts: 2
sp_UserOfflineSmall Offline

I'm working on a synthesizer plugin that does frequency modulation.  
I've been trying to tackle the problem of aliasing, and I have a question about low pass filtering as part of my method, which I will try to explain...

1) I have to do oversampling (by a factor of 'm') in my synthesis calculations so that the effective Nyquist limit is much higher than the host sample rate Nyquist limit.  
    This prevents high frequencies from aliasing.

2) I have to low pass filter the oversampled signal, so that when I downsample back to host sample rate there will be no frequency content above the host Nyquist limit.

3) Lastly I downsample by summing every (mth) sample, and then dividing this sum by 'm'. 
    For example, if I am using x8 oversampling, I will sum together 8 samples and divide the result by 8 to get my final sample output at the host sample rate.  

I'm relatively new to filter theory and coding filters, so I opted to borrow some code from the 'ResonantLPF' RackFX project.  
Specifically, I have borrowed the Biquad object from the RackFX example code to do my low pass filtering at stage 2).  
This prototype anti-aliasing system works in basic way, although it is computationally expensive and does not prevent aliasing perfectly.

So my question is... what sort of filter (as opposed to the 'ResonantLPF') would be ideal for improving this anti-aliasing process?  
Is there anything else in the FX book that I could turn my attention to?  

May 20, 2018 - 5:47 pm
Member Since: January 29, 2017
Forum Posts: 698
sp_UserOfflineSmall Offline

There is an App Note on oversampling (Multirate) and the filtering requirements here:

This uses the "textbook" linear phase FIR filters which are decomposed into smaller polyphase filters. If you want to do it correctly, this is the way to go. The major hurdle is convolution with the long FIR filters, even after making them more efficient (see the App Note).

You may also find papers on using IIR filters instead and there are also some "budget" versions that I've run across, but never got too interested in.

You might also want to check the code for the VCV Rack synth plugins which (if I remember correctly) includes some oversampling code.

Hope that helps,

- Will 

New Member
May 21, 2018 - 10:27 am
Member Since: May 20, 2018
Forum Posts: 2
sp_UserOfflineSmall Offline

11/10 answer - thank you!  I have one follow up question...

I didn't know about impulse response generator in RackFX - pre-computing my filter coefficients should be a big help.
I'm just wondering how I could do the process of generating the impulse responses from inside my code, rather than using RackFX to do this outside of my code? 
I would prefer to be able to generate impulse responses for a low pass filter from inside my code, but with a sample rate argument that would cause the impulse responses to re-generate if the sampling rate changes (or if other parts of my code require the filter to work at an arbitrary oversampling rate).   

Would this be reasonably possible?  

May 25, 2018 - 11:42 am
Member Since: January 29, 2017
Forum Posts: 698
sp_UserOfflineSmall Offline

RackAFX uses the Optimal Method and Frequency Sampling methods to generate impulse responses and FIR filters. I can't give out the code for that but I can tell you where I got it:

Both the Optimal Method and Frequency Sampling method code originally came from a great DSP book called "Digital Signal Processing: A Practical Approach" by Ifeachor and Jervis and it is listed int the Bibliography of the FIR and IIR chapters in the FX book. I just coded in C++ the algorithms they describe so well, and they also provide some raw C code as well. They also describe and show the implementation for the Windowing method (a third and very popular method to generate FIR filters). My version is their first edition, published in 1993 (and I still use it today) - but there are newer versions out there. 

The only tricky thing with the Optimal Method is the Remez Exchange Algorithm and I used a very old (but stable) version you can get here:

Hope that helps,


Forum Timezone: America/New_York

Most Users Ever Online: 152

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Chaes: 56

Skyler: 48

StevieD: 46

Derek: 46

Frodson: 45

Peter: 43

TheSmile: 43

Nickolai: 43

clau_ste: 39

jeanlecode: 37

Member Stats:

Guest Posters: 2

Members: 786

Moderators: 1

Admins: 6

Forum Stats:

Groups: 13

Forums: 42

Topics: 853

Posts: 3385

Moderators: W Pirkle: 698