Understanding oversampling

This isn’t really a JUCE question…more of a general DSP question.

I’m trying to better understand oversampling and I have the basic idea, I’m just missing a piece or two. Here’s what I understand so far…

Considering a simple 2x oversampling, the steps are:

  • Upsample by placing a zero after every input sample, resulting in a buffer 2x the original size
  • Filter that buffer to remove the aliasing
  • process my buffer (in my case, a distortion algorithm)
  • Filter that buffer again
  • Downsample by removing every other sample

This post in KVR explains it very nicely, https://www.kvraudio.com/forum/viewtopic.php?p=455226#p455226), my only confusion is: at what frequency do you place the filters?

The post says to filter at sampleRate / 4, but which sampleRate is he talking about? The original sampleRate or my new upsampled rate?

For the purposes of this discussion, let’s say I’m upsampling 2x, using a lowpass JUCE IIRFilter and my original sampleRate = 48000. How do I set that filter? With a frequency of 24k and a sampleRate of 96k?

Thanks.

Also, I realize that I could use the dsp::oversampling class, but I feel the need to understand it better.

The cut off should be at the Nyquist frequency, which the the half of source sample rate. If you upsample 2x the oversampled samplerate is doubled, so to get the half source samplerate you need to divide the oversampled samplerate through 4.

Example
Src Samplerate 44100
with Nyquist Frequency at 22050

Oversampled sample 88200

3 Likes

Ah, as I suspected. Thank you for confirming.