DSPRelated.com
Forums

Upsampling question - the logic behind?

Started by John March 20, 2005
When we upsample by factor of 2, i.e. adding 1 zero between each sample, we 
actually double the FS but also create a duplication of the spectrum up to 
the new FS. If this is the case how can a LPF work, now we have the 
spectrum larger than the new FS/2 because of the duplication.

What do we actually gain by doing upsampling?

Many thanks

John.
"John" <john53@hotmail.com> wrote in message 
news:961F80D11johnhotmalcom@195.20.224.116...
> > When we upsample by factor of 2, i.e. adding 1 zero between each sample, > we > actually double the FS but also create a duplication of the spectrum up to > the new FS. If this is the case how can a LPF work, now we have the > spectrum larger than the new FS/2 because of the duplication. > > What do we actually gain by doing upsampling? > > Many thanks > > John.
John, Upsampling is the essence of interpolation. There are lots of situations where interpolation is needed. One example is this: we sample some lowpass-filtered data at the lowest possible sample rate and efficiently store the samples. Then, we want to visualize the waveform - so interpolation by a large factor is desired. I'm not sure what you mean: "how can a LPF work?" It works the same as always, by limiting the spectrum of the signal that's applied to it. Now, perhaps your issue is how you view the "sample rate" of the lowpass filter. Actually, it's not so useful to think of filters as having a sample rate. It's better to think of the filters as being implemented at the *current* sample interval - whatever that may be. Taking interpolation as an example: Start with signal bandwidth B < fs/2. Sample the signal at fs. Stuff zeros between the samples so that now we are using a sample frequency 2*fs. As you have noted, the spectrum now repeats at fs. A lowpass filter with bandwidth < fs/2 (which is the new sample frequency /4) will fill in the zeros, thus interpolate. Back to the filter normalization issue from above: Let's say that the original signal bandwidth is 4kHz. Let's say the the original sample rate is 10kHz. We can imagine a lowpass filter with unit delays that are the same as the sample interval 1/10,000=0.1msec. Let's assume it's an FIR filter just for convenience. Let's imagine a lowpass filter with such delays that has a 4kHz passband - which happens to be 0.4*fs. In principle, applying the filter won't change the samples (or, all that much at least). Now, let's zero-stuff the original samples with zeros. Now the sample rate is 20kHz. If we use the *same* filter coefficients as the FIR above, the unit delays would be 0.05msec=1/20,000. This means that the filter cutoff frequency will be 0.4*fs as before which is 8kHz. The resulting samples coming out of this filter won't be an interpolated version of the input. So, to effect the interpolation, we must still use a filter with cutoff frequency of 4kHz which is now 0.2*(2*fs). This is 0.2 times the new sample frequency. This is not the same FIR filter that we used above because the fractional bandwidth has gone from 0.4*fs to 0.2*fs [where, here, fs means the current fs]. It is the fractional bandwidth that matters - not the absolute sample interval, sampling frequency, cutoff frequency, passband edge, etc. So, you will notice in a lot of filter design programs that the sample frequency is set to 1.0 and the band edges are all fractions, i.e. <1.0 and, because of the sampling theorem are generally <0.5. So, a filter might be specified like this: Passband 0>0.2 Transition band 0.2>0.25 Stopband 0.25>0.5 And the sample rate can be anything..... I hope you can now visualize the original spectrum, the original spectrum repeated *and* the repeated spectrum lowpass filtered such that all that's left is the original spectrum and no more. Fred Fred
Hi Fred,

Thank you very much for your detailed answer. Now things are much clearer 
to me!

John

fmarshallx@remove_the_x.acm.org (Fred Marshall) wrote in
<pvGdnTjMkP0NRaDfRVn-tg@centurytel.net>: 

>to effect the interpolation, we must still use a filter with cutoff >frequency of 4kHz which is now 0.2*(2*fs). This is 0.2 times the new >sample frequency. This is not the same FIR filter that we used above >because the fractional bandwidth has gone from 0.4*fs to 0.2*fs [where, >here, fs means the current fs]. > >It is the fractional bandwidth that matters - not the absolute sample >interval, sampling frequency, cutoff frequency, passband edge, etc. So, >you will notice in a lot of filter design programs that the sample >frequency is set to 1.0 and the band edges are all fractions, i.e. <1.0 >and, because of the sampling theorem are generally <0.5. >So, a filter might be specified like this: >
john53@hotmail.com (John) writes:

> When we upsample by factor of 2, i.e. adding 1 zero between each sample, we > actually double the FS but also create a duplication of the spectrum up to > the new FS. If this is the case how can a LPF work, now we have the > spectrum larger than the new FS/2 because of the duplication. > > What do we actually gain by doing upsampling?
That's like asking "what do we actually gain by doing integration"? Integration is not a means unto itself. You do it as part of a process designed to get from one point to another, i.e., with some higher-level purpose in mind. Same with upsampling. As an example of a reason for upsampling, consider the situation in which you need to perform a nonlinearity on the signal, such as compressing or limiting. Since the harmonics from the nonlinear operation that are past the Nyquist frequency (Fs/2) will alias back down into the passband, it may be a good idea to oversample before you perform the nonlinearity. There is nothing inherently better about an upsampled signal, and it actually is worse from a practical viewpoint since the hardware or computer operating on the samples has to work harder for the same amount of information. -- Randy Yates Sony Ericsson Mobile Communications Research Triangle Park, NC, USA randy.yates@sonyericsson.com, 919-472-1124
"What do we actually gain by doing upsampling?" There are a number of 
reasons to upsample--maybe to match the rate of the output hardware, 
maybe to make it easier to combine with other files of a higher sample 
rate, or perhaps you need to vary the playback rate, and upsampling 
gives you a higher-time-resolution basis to follow with some cheaper 
interpolation for the variable rate. Or maybe you need frequency 
headroom for a non-linear process to follow (to minimize the amount of 
aliasing that reflects back into the audio range).

You said that adding the zeros creates "the duplication of the spectrum 
up to the new FS. Another way to look at it is that zero insertion 
simply doubles the Fs (that is, the "duplication"--in the form of a 
mirror image--was already there. That's why we need an antialiasing 
filter below Fs/2 following the digital to analog converter when playing 
back the original signal.) Either way you look at it, the need for the 
low pass filter following the zero-insertion is obvious--you have an 
aliased copy of the "good" audio occupying the upper half of the newly-
doubled audio band, and you need to get rid of it (in most cases). I'm 
not sure if that's what you were aking about the LPF or not... but you 
seem to be on the right track :-)


In <961F80D11johnhotmalcom@195.20.224.116> John wrote:
> > When we upsample by factor of 2, i.e. adding 1 zero between each > sample, we actually double the FS but also create a duplication of > the spectrum up to the new FS. If this is the case how can a LPF work, > now we have the spectrum larger than the new FS/2 because of the > duplication. > > What do we actually gain by doing upsampling? > > Many thanks > > John. >
"Nigel Redmon" <earlevel@earlevel.com> wrote in message 
news:20050328200411308-0800@news.linkline.com...
> "What do we actually gain by doing upsampling?" There are a number of > reasons to upsample--maybe to match the rate of the output hardware, > maybe to make it easier to combine with other files of a higher sample > rate, or perhaps you need to vary the playback rate, and upsampling > gives you a higher-time-resolution basis to follow with some cheaper > interpolation for the variable rate. Or maybe you need frequency > headroom for a non-linear process to follow (to minimize the amount of > aliasing that reflects back into the audio range). > > You said that adding the zeros creates "the duplication of the spectrum > up to the new FS. Another way to look at it is that zero insertion > simply doubles the Fs (that is, the "duplication"--in the form of a > mirror image--was already there. That's why we need an antialiasing > filter below Fs/2 following the digital to analog converter when playing > back the original signal.) Either way you look at it, the need for the > low pass filter following the zero-insertion is obvious--you have an > aliased copy of the "good" audio occupying the upper half of the newly- > doubled audio band, and you need to get rid of it (in most cases). I'm > not sure if that's what you were aking about the LPF or not... but you > seem to be on the right track :-)
Another way of looking at it, or dealing with it would be to: FFT a record. Double the length of the FFT by repeating it. IFFT the doubled record. Voila' the zeros have been inserted. Not that I'm suggesting this..... Of course, one might lowpass filter by multiplication in frequency before doing the IFFT. Then the process might be truly useful. Interpolation by operations in the frequency domain that go beyond merely filtering. Fred
john53@hotmail.com (John) wrote in message news:<961F80D11johnhotmalcom@195.20.224.116>...
> When we upsample by factor of 2, i.e. adding 1 zero between each sample, we > actually double the FS but also create a duplication of the spectrum up to > the new FS. If this is the case how can a LPF work, now we have the > spectrum larger than the new FS/2 because of the duplication. > > What do we actually gain by doing upsampling? > > Many thanks > > John.
In "old" implementation of CD audio players (i.e. with high-res "multi bit" DAC) up-sampling the output digital signal (just before the DAC stage) was useful for two main reasons: 1) reducing quantization noise (suppose -as first approx- to be white) 2) the analog low pass filter at the output of the DAC had less attenuation in case of up-sampling (part of the low pass filtering was carried out digitally). the implementation of the analog LPF (generally based on OP-amps) was less critical due to less attenuation required outside the audio band. sometimes up-sampling was called "oversampling". Jack