SouthSIDE Glen said:
One of the main concepts is that "stairstepping" is a nice graphical way to explain the basics of digital sampling of an analog signal, but it is very misleading or at least incomplete - to the point of downright wrong in some aspects - as a way to describe the conversion of digital back into analog. The electronic math used - regardless of converter design type - is not meant to connect the dots or smooth the slope between discreet analog values; not in the way inferred by such starstep graphics. There just simply are not enough dots to connect with any accuracy whatsoever, even at frequencies below 10kHz.
Sure, there are. That's the crux of what Nyquist guarantees: that any artifacting produced by sampling will necessarily be at a characteristic frequency above the Nyquist point. I'll explain.
If you have four points representing a wave (10 kHz signal at 40-ish kHz sampling rate) and you generate a stair-stepped signal with a 48 kHz sampling rate, the step size is producing a square wave approximation of the sound, but the sharp points of that square wave are at a frequency of precisely 48 kHz, which means they're well outside the human hearing range.
Thus, while you may not be able to reproduce a perfect sine wave at 10 kHz, it is not necessary to do so because any artifacts caused by the lower sampling rate are just adding overtones that are similarly outside the human hearing range. You can replace that sine wave with even a raw sawtooth wave at 10 kHz and most people can't hear a difference because the lowest frequency harmonic added is at 20 kHz.
Since the signal produced by a simple DAC as described in Wikipedia would more closely resemble a square wave, and since you only have odd harmonics, the lowest possible harmonic is the next odd harmonic, which is three times the frequency (first harmonic is the fundamental, second is twice the frequency/an octave up, next harmonic is three times the frequency/an octave and a fifth up), or about 30 kHz, well outside the human hearing range.
As mentioned earlier, however, because it is just an approximation of a square wave, rather than
precisely being a square wave, the frequency of the distortion is actually at 48 kHz.
As a result of the frequency of the distortion being outside the range of human hearing, to get as accurate a reproduction as the human ear can perceive, it is necessary only to add a low-pass brickwall filter at 22 kHz or so---maybe at 24 kHz just to avoid having to build such a steep analog filter.
In fact, if all you care about is human hearing, you don't technically even have to have a low-pass filter. The stairsteps will be well outside of the range of human hearing, as mentioned earlier. That said, everyone always puts one in anyway to avoid the risk of blowing out tweeters with a high intensity signal at 48 kHz.
And indeed, that's all a typical reconstruction filter is. It is a simple low pass filter set just above the range of human hearing. When people say that there is no stairstepping in the output of a DAC, it is not because they're doing some complex math on the output. The output is already analog, so there's not any math or manipulation that can practically be done. All that can be done once you're in the analog domain is to remove the frequencies outside the human hearing range that cause the stairstepping.
Even at half the sample rate, you are getting two points per cycle, and because each point holds at that value until the start of the next sample, you never get a sawtooth wave. It is always a square wave. Thus, even if you generate a 24 kHz test tone at 48 kHz sampling rate, you could reproduce it so accurately that even a dog couldn't hear that it wasn't a sine wave. You would have one sample high and one sample low, so it would be a perect 24 kHz square wave, the first harmonic of which is at 4 * 24 kHz = 96 kHz.
Of course, that's with only two samples per cycle. With a 10 kHz tone, you have almost five whole samples. That's
huge by comparison!
BTW, I may well be wrong about the potential for amplitude loss near half the sampling frequency during capture. Oversampling may completely compensate for that. It would depend largely on how the ADC does its oversampling as to whether it uses a sum, a weighted average, some sort of max/min finding algorithm, etc. Any of those techniques will result in some type of error, but the error will be in different domains.
When reducing the oversampled signal to the desired sampling rate, a max/min finding algorithm would result in equal amplitude but potentially subtle errors in the frequency and phase distortion. I think it is likely that this would not be audible at the frequencies we're talking about here, but I wouldn't swear to it.
By contrast, a weighted average or unweighted average would probably be the most audibly pleasing if that phase distortion turns out to be audible. However, it would result in HF roll-off as you approach the sampling rate.
I'm not sure which technique modern oversampling ADCs use in practice.