Stupid question on sampling theorem and aliasing

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Hi!

Sorry if it seems obvious to you but it is counter-intuitive to me...
I understand the problem of going above 1/2 SR. But why isn't the theorem expressed/extended this way?

Code: Select all

Any frequency that isn't equal to SR/n with n>=2 can't be sampled correctly.
Why are we fine with a 15kHz sine played at 44.1kHz? There will be a periodic amplitude variation and to me it should alias.

Please enlighten a noob :neutral:

Post


Post

Thanks!

Post

Barbouze wrote: But why isn't the theorem expressed/extended this way?

Code: Select all

Any frequency that isn't equal to SR/n with n>=2 can't be sampled correctly.
Because it's wrong. You can also reconstruct signals above SR/2, if you know about the signal. See Bochner's theorem.

Barbouze wrote: Why are we fine with a 15kHz sine played at 44.1kHz?
For 44.1kHz SR, SR/2 would be 22kHz. On a 15kHz pure sine, there is no frequency above 15kHz, so your are fine.
Barbouze wrote: There will be a periodic amplitude variation and to me it should alias.
If there is periodic amplitude variation, this is no more 15khz sine, but a 15khz sine with periodic amplitude variation. So additional frequencies add on top

Post

The main issue with the theorem is that the idea is that this sampled data is sampled to infinity. So it doesn't change and you get all the points of the curve. If this is the case, then any frequency inside a fs/2 bandwidth can be reconstructed.
For instance, if you sampled at fs, you can actually reconstruct a signal that was between fs and 3fs/2 if there is nothing in the rest of the spectrum, as PurpleSunray says.

Post

Barbouze wrote: Why are we fine with a 15kHz sine played at 44.1kHz? There will be a periodic amplitude variation and to me it should alias.
when you say, we will see amplitude modulation, you implicitly assume a rather simple reconstruction process - like linear interpolation, maybe? which is not the "right" process for recosntruction. what you should actually (theoretically) use, is a sinc filter extending from minus to plus infinity on the timeline. with such an infinite length reconstruction filter, the amplitude modulation will go away. farther away samples will contribute just the right amount of signal to every time instant to make it go away. obviously, in practice, we need to use finite length approximation of the ideal sinc filter, ...
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

Hopefully related to the topic--

Am not familiar with many modern audio editor windows. Are there some audio editors with "really really excellent" brickwall interpolation on visual audio display, when zoomed-in to the sample level?

Because it is usually good enough for purpose, am still using Cool Edit Pro for some tasks. Still works great on Win10 and has pretty good graphic interpolation, drawing the anti-aliased solid waveform line connecting the sample dots.

Noticed the same as mentioned by Barbouz-- With sine wave sweeps in the top octave or two, the displayed interpolated waveform begins to ripple in amplitude, rising and falling in amplitude according to instantaneous frequency. Visually resembles a comb filter or intermodulation effects.

I never closely investigated. Guessed maybe he was doing "as good possible" visual interpolation on such an early program targeted for the slow computers of that era. Which was wonderful programming work for that era, and remains better at displaying waveforms than some modern editor windows. For instance, I really like Reaper but a zoomed-in wave display did not look realistic enough for "precision work" when I tried it, unless there are settings I couldn't find.

Do some editor windows do it "perfect enough" that a high freq sine sweep, zoomed in to multiple-pixels-per-sample, shows steady amplitude level all the way up?

Or maybe graphic smoothing that would get rid of high freq amplitude wiggles, the filter latency would get so long that it no longer does a good job on general-duty waveform display? IOW, maybe code which eliminates high freq amplitude wiggles in a sine wave display, could cause undesirable display artifacts on the most common case of mixed-frequency broadband waveform display?

Post

JCJR wrote:Are there some audio editors with "really really excellent" brickwall interpolation on visual audio display, when zoomed-in to the sample level?
IL Edison (or just Edison, included with FL studio) has a great sinc interpolation overlayed on top of the zero-order sample display.

Post

Music Engineer wrote:
Barbouze wrote: Why are we fine with a 15kHz sine played at 44.1kHz? There will be a periodic amplitude variation and to me it should alias.
when you say, we will see amplitude modulation, you implicitly assume a rather simple reconstruction process - like linear interpolation, maybe? which is not the "right" process for recosntruction. what you should actually (theoretically) use, is a sinc filter extending from minus to plus infinity on the timeline.
DACs use analog filters mostly... although some might use linear phase?
The key point is in a reconstruction filter is eliminating the "spectral mirrors" by lowpass filtering. How this actually works.. idk.. I would be glad to hear a DAC with no anti-imaging filter for comparison. You are correct that linear interpolation is not a lowpass filter.

Post

camsr wrote:DACs use analog filters mostly... although some might use linear phase?
as far as i know, there are DACs that use oversampling (together with digital fir filters) out there. somehow it seems to be possible to trade off sampling rate against bit resolution. with 16x oversampling (at 44.1 kHz sample rate), they can use just 1 bit and still provide cd quality - on the average...or something:
https://en.wikipedia.org/wiki/1-bit_DAC
The key point is in a reconstruction filter is eliminating the "spectral mirrors" by lowpass filtering. How this actually works.. idk.. I would be glad to hear a DAC with no anti-imaging filter for comparison.
i think, you wouldn't hear them. they are all above 20 kHz. it's basically a spectral replication, but the duplicates are out of the audible range. they only become audible, when they alias - but we are already back in the analog domain at this point - so they don't alias, they are just inaudible. ...well, maybe some analog nonlinear distortions can bring them back into the audible range, too (intermodulation distortion or whatever, so it seems to be a good idea to get rid of them anyway)
You are correct that linear interpolation is not a lowpass filter.
it is. but a rather poor one. if i'm not mistaken, its frequency response is that of a triangular window:

https://en.wikipedia.org/wiki/Window_fu ... lar_window
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

Music Engineer wrote:
camsr wrote:
You are correct that linear interpolation is not a lowpass filter.
it is. but a rather poor one. if i'm not mistaken, its frequency response is that of a triangular window:
It also generates non-harmonic partials, afaik. At least it does in resampling, although that's different.

Post

Barbouze wrote:Hi!
Why are we fine with a 15kHz sine played at 44.1kHz? There will be a periodic amplitude variation and to me it should alias.

Please enlighten a noob :neutral:
maybe this will help:
the sample points (which many audio programs visualise as dots) are not equal to the amplitude
they are more like weight coefficients for the resampling filter

these dots happen to "fall" onto the actual continuous signal only at the very low frequencies, while the more you get towards Fs/2 - the dots go wild, but that's actually fine
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

It is a lot clearer to me, thanks all!
I must admit that I tend to use visual representations to understand concepts and as JCJR pointed, (most?) audio editors do not represent accurately the waveform generated from samples. Add Anto's comment and I now get it :)

Post

Maybe as a general tip for DSP newcomers:
don't try to learn anything about the signal by looking at it (visualy).

As you have noticed already, it is hard to emulate a reconstruction filter inside your brain, so that sample values actually compose a waveform.
It gets more obvious the more you dive into deeper topics. An impulse response of a filter describes it's charaterstic, but is quite hard to tell what a filter actually does by looking at samples values of an impulse response. Or, you look at a of bunch or real and imaginary values from a FFT .. what kind of signal is this? ;)

Post

Here is an excellent video about the topic. It explains in mundane terms why what you see is not what you get with digital audio signals.

https://youtu.be/cIQ9IXSUzuM

Post Reply

Return to “DSP and Plugin Development”