This is not a homework question (I'm out of school now 2 years). I'm thinking, let's say you have 2 systems, one at 32khz and the other at 48khz and you want to go between the two. Is there a way to accomplish this with a single filter? I have a feeling that if you make an FIR where every other coefficient is zero and exploit the fact that if fs = 32khz and 48-32=16=fs/2, then zeroing out every other coefficient of an FIR (but how many taps) would do both the zero-padding and the anti-aliasing simultaneously. Am I on the right track or is there some other trickery involved?


Now that I think about it, to go from 32khz to 48khz you interpolate 3x and decimate 2x (32*3=96khz...96/2=48). So in effect you would pad two zeros first but then take out one in the decimation, but just inserting one zero would yield 64khz decimation (with a 32khz lowpass decimation).


Furthermore, wikipedia interpolation: "Upsampling requires a lowpass filter after increasing the data rate, and downsampling requires a lowpass filter before decimation. Therefore, both operations can be accomplished by a single filter with the lower of the two cutoff frequencies. For the L > M case, the interpolation filter cutoff, \tfrac{0.5}{L} cycles per intermediate sample, is the lower frequency."


Yes, you can interpolate and decimate at the same time. This is called "resampling". If you google resampling you will find lots of information about it. And yes, your reasoning about resampling is mostly correct.

When thinking about resampling theoretically you usually put the interpolation first to avoid Nyquist issues. An interpolator is upsampling followed by a low-pass filter to get rid of the aliases. A decimator is a low-pass filter followed by dropping samples. You can combine the two by combining the two low-pass filters into one filter. If the overall rate change is greater than one, the low-pass filter has the same pass-band/cutoff as the interpolation filter. If the overall rate change is less than one then it has the same pass-band/cutoff as the decimation filter. The filter operates at the interpolation sample rate.

You can make the filter more efficient by not actually upsampling the data or dropping filter outputs. Instead, you use a polyphase filter for the interpolation and simply not calculate the results that will be dropped, but that is a topic for another day and another question.

  • $\begingroup$ So in this case a single 24khz cutoff lowpass with a sampling frequency of 48khz would do the trick to interpolate from 32khz to 48khz? This is ingenious. Thank you. (or is it 16khz running at 48khz? i keep on seeing the lower of nyquist cutoffs for L/M greater than 1) $\endgroup$ – panthyon Oct 9 '15 at 13:26
  • 1
    $\begingroup$ No, to go from 32 kHz to 48 kHz I would use a cutoff around 16 kHz, because that is your Nyquist frequency when you start off at 32 kHz. If you put the cutoff at 24 kHz you will likely get some aliasing between 16 and 24 kHz. This is the "overall rate change greater than 1" scenario, so you use the pass-band/cutoff of the interpolation filter. $\endgroup$ – Jim Clay Oct 9 '15 at 13:30
  • 1
    $\begingroup$ Using the passband/cutoff of the decimation filter means that you are aiming to avoid aliasing when you decimate, which means that you need to set the cutoff to 16 kHz, because that is your Nyquist frequency after you decimate. Maybe a simpler way to think of it is that you set the cutoff of the anti-aliasing LPF according to the lowest sample rate, whether that be the input or output sample rate. $\endgroup$ – Jim Clay Oct 9 '15 at 14:07
  • 1
    $\begingroup$ You can either zero stuff or use the polyphase filter approach. Both produce the same results. $\endgroup$ – Jim Clay Oct 9 '15 at 16:09
  • 1
    $\begingroup$ If you are interested in looking at a C++ implementation of resampling filters, you can look at my DSP library, NimbleDSP. github.com/JimClay/NimbleDSP $\endgroup$ – Jim Clay Oct 9 '15 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.