Oversampling LPF question

DSP, Plug-in and Host development discussion.
mystran
KVRAF
5651 posts since 12 Feb, 2006 from Helsinki, Finland

Post Thu Feb 20, 2020 6:23 pm

Z1202 posted two images, both showing the same step-transition (presumably from a square wave), but sampled at two different sampling rates.

The whole premise of Shannon-Nyquist sampling is that we can perfectly reconstruct a band-limited signal after sampling. Hence, it makes sense to reason that for all intents and purposes, it remains very much the same signal, no matter where and how many sampling points we are placing, as long as the sampling is dense enough to avoid aliasing.

So the "perfectly" interpolated curve is really what matters and any change in the ripples of the interpolated curve when changing the sampling rate is always the result of an error term in the resampling process. On the other hand, if the interpolated curve remains the same, it really doesn't matter what the samples look like. For example, fractional delays will change the "ripple" in the samples, but if you add more fractional delay until it becomes an integer again, you'll be back to the original (because the underlying signal didn't change, the sampling grid just moved in time), except for potential error terms of a practical implementation.

You might want to treat the samples as impulses during the resampling process, there is nothing wrong with that. But when a WAV file is loaded into a DAW, the samples contained in the wavefile are very much not impulses, but rather just values of a band-limited signal that we have stored and which we intend reproduce again at playback (even though the whole DAC process will probably go through a couple of steps, changing the signal on the way, but that's implementation detail; eventually we still want to get at close to as possible to the original signal)... and I would assume that is also what Z1202 is trying to point out.
Please just let me die.

earlevel
KVRian
546 posts since 4 Apr, 2010

Re: Oversampling LPF question

Post Thu Feb 20, 2020 6:49 pm

mystran wrote:
Thu Feb 20, 2020 6:23 pm
Z1202 posted two images, both showing the same step-transition (presumably from a square wave), but sampled at two different sampling rates.

The whole premise of Shannon-Nyquist sampling is that we can perfectly reconstruct a band-limited signal after sampling. Hence, it makes sense to reason that for all intents and purposes, it remains very much the same signal, no matter where and how many sampling points we are placing, as long as the sampling is dense enough to avoid aliasing.

So the "perfectly" interpolated curve is really what matters and any change in the ripples of the interpolated curve when changing the sampling rate is always the result of an error term in the resampling process. On the other hand, if the interpolated curve remains the same, it really doesn't matter what the samples look like. For example, fractional delays will change the "ripple" in the samples, but if you add more fractional delay until it becomes an integer again, you'll be back to the original (because the underlying signal didn't change, the sampling grid just moved in time), except for potential error terms of a practical implementation.
You've lost the context a bit. Z1202 was giving me case where a user/musician gets confused by seeing "lollipops", and said explaining that by, 'Saying "an interpolation curve of sufficiently high interpolation quality" should be good enough.' While saying explaining it the way I do would be tougher. I don't see how, but again I'm talking about explaining theory, not telling a musician how to understand his DAW. He said, "Maybe you should try doing that sawtooth experiment yourself to know what I'm talking about." I asked him to explain the experiment, which was initially stated as 100 Hz sawtooth...etc.

So your comments don't apply to the exchange.
You might want to treat the samples as impulses during the resampling process, there is nothing wrong with that. But when a WAV file is loaded into a DAW, the samples contained in the wavefile are very much not impulses, but rather just values of a band-limited signal that we have stored and which we intend reproduce again at playback (even though the whole DAC process will probably go through a couple of steps, changing the signal on the way, but that's implementation detail; eventually we still want to get at close to as possible to the original signal)... and I would assume that is also what Z1202 is trying to point out.
That's a conversation abandoned earlier in the thread (pre-"Wanted to share an example..."), but I'll say again, I disagree with your statement about what the samples are. You 1) say they aren't impulses, but 2) they are samples of the band limited waveform. Samples of a band limited wave form are, for mathematical purposes, impulses. It's the very reason we need a lowpass filter—because the samples aren't bandlimited. It's why aliasing happens, and it's why sample rate conversion requires lowpass filters. Obviously, we disagree. I don't need to change your mind, I'm fine with it, but I'm not going to agree with your assertion.

PS—Remember, the samples container of that wav file is PCM. That’s a pulse-code-modulation signal, not a band limited one.
My audio DSP blog: earlevel.com

User avatar
kryptonaut
KVRian
752 posts since 25 Apr, 2011

Re: Oversampling LPF question

Post Sun Feb 23, 2020 10:13 am

earlevel wrote:Samples of a band limited wave form are, for mathematical purposes, impulses. It's the very reason we need a lowpass filter—because the samples aren't bandlimited. It's why aliasing happens, and it's why sample rate conversion requires lowpass filters.
Samples are just numbers indicating the value of the analog waveform at particular times. If the waveform was bandlimited then the sampling theorem says that you can perfectly reconstruct the analog waveform from the samples. But the samples are not impulses because impulses are (idealised) analog signals and the samples are just numbers.

You can construct a stream of impulses using the samples, and you can subsequently filter the impulses to make the analogue waveform. Or you can construct a set of sinc signals (essentially pre-filtered impulses) using the samples and use them to recreate the same waveform. But the samples themselves are neither impulses nor sinc waveforms, they are just numbers, measurements of the analog waveform at particular times.

earlevel
KVRian
546 posts since 4 Apr, 2010

Re: Oversampling LPF question

Post Sun Feb 23, 2020 10:53 am

kryptonaut wrote:
Sun Feb 23, 2020 10:13 am
earlevel wrote:Samples of a band limited wave form are, for mathematical purposes, impulses. It's the very reason we need a lowpass filter—because the samples aren't bandlimited. It's why aliasing happens, and it's why sample rate conversion requires lowpass filters.
Samples are just numbers indicating the value of the analog waveform at particular times. If the waveform was bandlimited then the sampling theorem says that you can perfectly reconstruct the analog waveform from the samples. But the samples are not impulses because impulses are (idealised) analog signals and the samples are just numbers.

You can construct a stream of impulses using the samples, and you can subsequently filter the impulses to make the analogue waveform. Or you can construct a set of sinc signals (essentially pre-filtered impulses) using the samples and use them to recreate the same waveform. But the samples themselves are neither impulses nor sinc waveforms, they are just numbers, measurements of the analog waveform at particular times.
Kind of stating the obvious here, k, pretty sure no one thinks we have somehow coerced computer memory to maintain an analog impulse.

What I said, if you scroll back to the comment that started this, was, "I don't want to start a fight, but samples represent impulses". The math works for impulses, exactly, and is the reason it's often referred to as "ideal sampling", it represents the mathematical ideal.

And the math works for sampled analog as impulse trains too. Obviously, it works as well as you can make impulses, which is actually virtually perfect for something as low bandwidth as audio. (Where you see the effect of a non-ideal pulse is mainly if you look at the spectrum of the sample train, the images will fall off as you go to very high frequencies.) But there are more economical/easier ways to reconstruct, we don't need to generate pulses—that doesn't change what the samples represent. And even using s&h on the input is effectively multiplying by a pulse train, since we discard everything but the measurement (there is no difference between multiplying by a pulse and perfectly capturing the instantaneous peak, and performing a s&h and measuring more leisurely, except for latency which we don't care much about and that the latter is easily realizable).

But you go too far to say samples are just numbers. They are numbers that represent something. Otherwise we wouldn't know what to do with them.
My audio DSP blog: earlevel.com

earlevel
KVRian
546 posts since 4 Apr, 2010

Re: Oversampling LPF question

Post Sun Feb 23, 2020 1:21 pm

As long as we're looping on the thread, I'll point out a couple of things:

"Samples aren't [or don't represent] impulses"—OK, then why do we test an LTI system's impulse response by feeding it a single non-zero sample? You feed an impulse to obtain an impulse response, no?

"It can't be an impulse because perfect impulses don't exist in the real world"—that's like saying we can't have digital audio because the signal must be bandlimited, yet that's impossible with a finite sequence (a bandlimited signal cannot also be time limited). Pedantry.
My audio DSP blog: earlevel.com

Return to “DSP and Plug-in Development”