## Oversampling LPF question

DSP, Plug-in and Host development discussion.
mystran
KVRAF
5651 posts since 12 Feb, 2006 from Helsinki, Finland
Z1202 wrote:
Tue Feb 18, 2020 3:45 am
mystran wrote:
Tue Feb 18, 2020 3:32 am
You would need complex sampling if you want to differentiate between positive and negative frequencies; with cardinal sines you only get half of it.
Hmmm, I'm not sure. What if I multiply a cardinal sine with a complex value?
Oh, fair enough. Not sure what I was thinking.

Z1202
KVRian
1147 posts since 12 Apr, 2002
earlevel wrote:
Tue Feb 18, 2020 10:38 am
I don’t think the sinc explanation is sufficient. It doesn’t explain aliasing well, and especially doesn’t explain zero insertion for upsampling well (why do we need to filter again if we’ve only added zero-scaled sincs?). It doesn’t even explain, in itself, the need to bandlimit the input. With impulses, all of those things are implicit, obvious consequences of the AM involved.
If you want to insist that we stick to one interpretation only, I'd agree that it rather should be the lollypops, which is the most powerful one. I was arguing that it's not the most intuitive one, hence shouldn't be the go-to interpretation. But if you really have to stick to only one... (although, why???).

Oh, and there are very intuitive explanations of aliasing or the need for bandlimiting in terms of interpolation (they are not necessarily rigorous proofs, but work very well in terms of intuitive understanding).

earlevel
KVRian
546 posts since 4 Apr, 2010
Z1202 wrote:
Tue Feb 18, 2020 10:04 pm
earlevel wrote:
Tue Feb 18, 2020 10:38 am
I don’t think the sinc explanation is sufficient. It doesn’t explain aliasing well, and especially doesn’t explain zero insertion for upsampling well (why do we need to filter again if we’ve only added zero-scaled sincs?). It doesn’t even explain, in itself, the need to bandlimit the input. With impulses, all of those things are implicit, obvious consequences of the AM involved.
If you want to insist that we stick to one interpretation only, I'd agree that it rather should be the lollypops, which is the most powerful one. I was arguing that it's not the most intuitive one, hence shouldn't be the go-to interpretation. But if you really have to stick to only one... (although, why???).

Oh, and there are very intuitive explanations of aliasing or the need for bandlimiting in terms of interpolation (they are not necessarily rigorous proofs, but work very well in terms of intuitive understanding).
Well, of course I think I made it clear I don't insist, I'm just defending my position. (Me: "I understand your reason for wanting to look at it the way you prefer...Please explain it how you like", and "I've given my point of view, you've given yours, I'm fine with that", for example.)

Myself, I find impulse sampling ("ideal sampling") extremely intuitive. It's funny to see threads (not this one) where people argue about things that are self-evident with impulse sampling (what magic stuffing zeros does, whether ot put the filter before or after, what frequency to set it to, why we need to sample at more than double the rate and why should it be sufficient). I find it counterintuitive to mentally impose a DAC on the signal while working with the signal in the discrete domain. If I want to consider the analog output, I consider the spectrum below half the sample rate. Not much mental work there.

Maybe it's my electrical engineering background, and I can understand it may not intuitive for everyone. Then again sampling isn't intuitive till it's grown on you a while, and I'm sure people get comfortable with a certain view, you and me included. That's fine.

And I do appreciate that you offered that you consider the impulse sampling model complete, even if you don't find it the most intuitive. And I'm well aware that both you and mystran (geez, how many times does autocorrect want him to be "mistral"?) are abundantly capable DSP minds and a huge help to people on this board.
My audio DSP blog: earlevel.com

Z1202
KVRian
1147 posts since 12 Apr, 2002
Wanted to share an example of where impulse model is largely misleading, which just occurred to me. (I still believe that it is also misleading in regards to the original ripple question, but it is still to an extent a matter of interpretation, while this is a much better example). Take an analog sawtooth (for simplicity let's assume it's perfect) whose period is not an integer multiple of the sampling period and sample it via a proper ADC process. Different periods of sampled sawtooth with look largely different in lollypops terms. And that has been a reason of major confusion for many people, claiming that "with real analog synths every period of the waveform is different from the other". In interpolation terms you can immediately see that all periods are the same.

earlevel
KVRian
546 posts since 4 Apr, 2010
Z1202 wrote:
Wed Feb 19, 2020 12:29 am
Wanted to share an example of where impulse model is largely misleading, which just occurred to me. (I still believe that it is also misleading in regards to the original ripple question, but it is still to an extent a matter of interpretation, while this is a much better example). Take an analog sawtooth (for simplicity let's assume it's perfect) whose period is not an integer multiple of the sampling period and sample it via a proper ADC process. Different periods of sampled sawtooth with look largely different in lollypops terms. And that has been a reason of major confusion for many people, claiming that "with real analog synths every period of the waveform is different from the other". In interpolation terms you can immediately see that all periods are the same.
First I gotta say...my comments were not about editors and visualizers, which might have sample-level editing, zoomable "analog" waveform, and even spectrogram view and editing. My comments were to explaining sampling. Maybe these confused people would benefit from an explanation. We don't hide that movies are made up of frames to someone interested in making movies despite how misleading it is.

I also suppose some of these people get confused when that sawtooth is lumpy, and when it turns into a sine at higher frequencies...not like what the synth front panel depicts. Not even a post-DAC view is going to save them from that.
My audio DSP blog: earlevel.com

Z1202
KVRian
1147 posts since 12 Apr, 2002
earlevel wrote:
Wed Feb 19, 2020 1:48 am
First I gotta say...my comments were not about editors and visualizers, which might have sample-level editing, zoomable "analog" waveform, and even spectrogram view and editing. My comments were to explaining sampling. Maybe these confused people would benefit from an explanation. We don't hide that movies are made up of frames to someone interested in making movies despite how misleading it is.

I also suppose some of these people get confused when that sawtooth is lumpy, and when it turns into a sine at higher frequencies...not like what the synth front panel depicts. Not even a post-DAC view is going to save them from that.
I'm not sure what you're referring to as lumpy. What I'm referring to is a sawtooth at reasonably low frequency (say 100Hz). And a post-DAC view would clearly not raise the same confusion, the sawtooth will look exactly periodic.

I'm also not sure about your parallel with movies. I'm not suggesting to hide that digital audio is made of samples. And I would distinguish between misleading facts which originate solely from the fact that the audio is sampled (I guess that's where your parallel with movies would kick in) and the misleading facts which appear in some interpretations but not the others, which would at least suggest that some interpretations are better at least in this respect.

As for your comments being not about editors and visualizers, maybe I misunderstood your intention, but the original question, as I understood it, was about the ripples. And ripples are a visual thing, aren't they?

earlevel
KVRian
546 posts since 4 Apr, 2010
Frankly, I’m unsure of where you’re going with this. If they see the samples, they are probably in a DAW or editor, and can probably view the interpolated waveform too. Each is useful in editing, so I don’t think you’re arguing that the samples should be hidden.

I think most people would catch on pretty quickly, seeing a sawtooth at one frequency and the sample “grid” as one that not a perfect multiple. I really don’t see people looking at 100 Hz sawtooths, but if they were confused I’d scribble a sawtooth, mark off a regular sample spacing—I think pretty much everyone knows about samples per second who is doing any recording—and I can’t imagine the concept would stump very many people. Sorry, I just don’t see how it’s not intuitive.

OTOH, I’m sure you’re not going to put them at ease by explaining sinc and superposition to them. So the only solution is...hide sample editing from them, and don’t let them record sawtooths unless the are low frequency?

Again, This is off topic for because I was talking about explaining theory to someone who wants to learn it, not foisting it on musicians in their favorite DAW. But I just don’t see how your musician example shows impulse sampling to be unintuitive in education. And I don’t think sinc will rescue them either.
My audio DSP blog: earlevel.com

Z1202
KVRian
1147 posts since 12 Apr, 2002
Maybe you should try doing that sawtooth experiment yourself to know what I'm talking about. At least from your reply I'm not sure if you understood what I'm getting at or not. At least scribbling a sawtooth and putting regular samples on it will put you through lots of confusion if you then compare your pictures with actual recordings if the latter are displayed as lollypops. Make sure to sample a real analog sawtooth or take a piece of software which delivers a high-quality antialiased sawtooth (not every synth does that).

And no, I'm not suggesting to hide samples in any way. However a decent wave display IMHO should display samples + interpolation curve, rather than display samples as lollypops.

As for explaining the theory, I get it, but you were explaining it in the context of a specific question, and in my opinion the classic approach to sample theory is more confusing than helpful for that particular question. YMMV.

And there is no need to actually explain the sincs. Saying "an interpolation curve of sufficiently high interpolation quality" should be good enough.

earlevel
KVRian
546 posts since 4 Apr, 2010
Z1202 wrote:
Wed Feb 19, 2020 5:15 am
Maybe you should try doing that sawtooth experiment yourself to know what I'm talking about. At least from your reply I'm not sure if you understood what I'm getting at or not.
The experiment, from what I've seen is,
Take an analog sawtooth (for simplicity let's assume it's perfect) whose period is not an integer multiple of the sampling period and sample it via a proper ADC process. Different periods of sampled sawtooth with look largely different in lollypops terms. And that has been a reason of major confusion for many people, claiming that "with real analog synths every period of the waveform is different from the other".
I countered that at higher frequencies, it wouldn't even look like a sawtooth. You countered,
What I'm referring to is a sawtooth at reasonably low frequency (say 100Hz)
I'm not sure why the confused person would restrict themselves to low frequencies, or even what software their stuck with "lollipops" except at severe zoom, but that's 441 samples per cycle at the lowest sample rate, and I don't see how they are going to get confused even with the worst of display choices by the DAW. For one thing, to get zoomed to separate lollipops , a single cycle would fill the screen.

I just recorded a 100 Hz sawtooth, because I already had my modular feeding my mixer and DAW open. I won't put up a picture, because it takes most of my screen for one to zoom just to the point Audacity (the worst lollipop maker I could think of) switches to samples. Still, the waveform takes no more than two samples to reach max swing, so I don't know how someone will get confused about the sawtooth.

And if they did get confused, I don't see how this would help:
Saying "an interpolation curve of sufficiently high interpolation quality" should be good enough.
I suspect that saying the samples are taken at a fixed interval, like the frames of a movie, would explain the cycle-to-cycle discrepancy better.

But I don't think you've stated a reasonable experiment, so if you think I'm having trouble understanding, that might be it.
My audio DSP blog: earlevel.com

earlevel
KVRian
546 posts since 4 Apr, 2010
PS—Here's the experiment at 100 Hz, and again at 1000 Hz, fwiw
saw_100_1000.png
I just don't see where explaining the cycle-to-cycle discrepancies on the right by saying something about "an interpolation curve of sufficiently high interpolation quality" is more intuitive than saying the samples are regularly spaced so they won't necessarily line up.

And frankly, if someone is that dim about sampling, won't they complain about the "noise" (inconsistent wiggles) on their nice sawtooth when recorded digitally? And really go off when it turns towards a sine at higher frequencies?

Or maybe you need to explain the experiment better, preferably with screenshots of you performing it.
You do not have the required permissions to view the files attached to this post.
My audio DSP blog: earlevel.com

Z1202
KVRian
1147 posts since 12 Apr, 2002
earlevel wrote:
Wed Feb 19, 2020 9:40 am
I just don't see where explaining the cycle-to-cycle discrepancies on the right by saying something about "an interpolation curve of sufficiently high interpolation quality" is more intuitive than saying the samples are regularly spaced so they won't necessarily line up.
By this (the line is the interpolated curve):
You do not have the required permissions to view the files attached to this post.

Z1202
KVRian
1147 posts since 12 Apr, 2002
And here is the illustration to the original ripples topic. There are no ripples in the samples themselves, but they are clearly visible in the "DAC" signal. After the 4x upsampling the _same_ ripples show up in samples. Which means the upsampling didn't "really create" the ripples, it's still 100% (or 99.9% or smth like that if the resampling and the DAC are not ideal) the same DAC signal after the upsampling.
You do not have the required permissions to view the files attached to this post.

earlevel
KVRian
546 posts since 4 Apr, 2010
Sorry, I don't know what you're getting at. You've moved from your original 100 Hz assertion to 2 kHz on the saw, said "By this", then shown two cases of ripple with at difference square wave frequencies. I don't see how that's presenting an experiment.

Anyway, again, I'm not even suggesting how a DAW should display it, but in any display you've down me, if someone is bewildered over the placement of the dots, I don't see how explaining that the samples are taken at the sample rate—a term everyone knows well—and independent of the input signal is confusing. And if it is confusing, I especially don't see how telling them about "an interpolation curve of sufficiently high interpolation quality" will click everything into place for them.

I'm happy to let it go.
My audio DSP blog: earlevel.com

Z1202
KVRian
1147 posts since 12 Apr, 2002
earlevel wrote:
Thu Feb 20, 2020 2:18 am
ou've moved from your original 100 Hz assertion to 2 kHz on the saw
Just so that the picture fits into the screen. It doesn't change anything at the matter.
earlevel wrote:
Thu Feb 20, 2020 2:18 am
shown two cases of ripple with at difference square wave frequencies
_One case_ (I thought I clearly stated that).

earlevel
KVRian
546 posts since 4 Apr, 2010
Z1202 wrote:
Thu Feb 20, 2020 2:33 am
earlevel wrote:
Thu Feb 20, 2020 2:18 am
ou've moved from your original 100 Hz assertion to 2 kHz on the saw
Just so that the picture fits into the screen. It doesn't change anything at the matter.
Sure it does—it would be sampled denser by 20x. Who'd going to be trouble with the samples being different? (And who's going to zoom high enough to even have the samples show up?)
earlevel wrote:
Thu Feb 20, 2020 2:18 am
shown two cases of ripple with at difference square wave frequencies
_One case_ (I thought I clearly stated that).
I count two images you posted, two different cases of a square wave where the samples fall. I don't know what you mean by one case or where you clearly stated it.

Anyway, same thing. If they ask about ripples, it's because we had to lowpass filter, sampling requires it. And that answer would apply at higher frequencies when they see the saw turning into a sine. If they ask why the samples don't land in the same place each time (who are these people who understand sawtooth waves but can't see the samples work?), it's due to the regular spaced sampling. And if they ask if the smooth version is really stored in memory (uh, really? They've head about number of samples in memory, right?), no, that's a calculation of how it will look when converted back to analog. I don't think these are tough concepts.

You've said that that for your explanation, 'Saying "an interpolation curve of sufficiently high interpolation quality" should be good enough.' That doesn't seem to apply to the samples question, which seemed to be the "problem" you posed to me ("Wanted to share an example of where impulse model is largely misleading").

Anyway, again, my comments on describing impulse sampling was to people wanting to learn DSP, not to DAW users. I'm not in charge of how DAWs display samples. Still, I fail to see how talking about impulses in light of a DAW displaying impulses is better suited to talking about sinc interpolation.

I don't think there's anything more to say on this.
My audio DSP blog: earlevel.com