• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Digital Audio Demystified

OP
NTK

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,714
Likes
6,002
Location
US East
Amir has a thread on the fundamentals of sigma-delta DAC. As Don has alluded to, the highest performance audio DACs these days are sigma-delta.

However, I have in my plan to write a post on DACs that use sample-and-hold, which is the most intuitive method and therefore how DACs were first implemented. This produces the stair-step waveform (see post #2) as part of the digital to analog conversion process. I just started preparing the materials and hopefully will have a post by this weekend.
 

DVDdoug

Major Contributor
Joined
May 27, 2021
Messages
3,029
Likes
3,989
Monty's video showed the post-DAC signal as a perfect sine wave with no stair stepping. I think he even said that the smoothness isn't even due to filtering a stair step. He made it sound like the DAC chip can literally somehow fit the correct curve to the sample points and output it smoothly.
I don't know how they work but interpolation would be "smoothing" although possibly not as smooth as analog filtering.

Filtering/smoothing isn't as important as you might think. One time I was doing some "weekend experiments" with a soundcard and an oscilloscope at work. I don't even remember what I was doing but I was shocked to see rectangular unfiltered signals coming out of the (cheap) soundcard!!! I was listening fairly regularly (on "cheap computer speakers". A little 2.1 setup) and I never noticed anything wrong. I never tried it on a better system so I'm not sure if I would hear anything or not. Then when I started thinking about it, the harmonics are ultrasonic so I can't hear them, the speakers will provide "mechanical" filtering, and the amplifier might not pass ultrasonic signals either.
 

txbdan

Active Member
Joined
Apr 21, 2020
Messages
213
Likes
199
Yeh, I'm a EE and at one time passed, although barely, the Signals and Systems course. hah. My understanding was that a DAC always had some small sample and hold induced stair step type feature. I don't work much with DACS or analog circuits so haven't thought much bout it. Monty's video where he's adamant about the output NOT being a stair step is what got my head spinning. Even a Sigma-Delta which seems sort of like a LPF'ed PWM signal may be plenty smooth enough, but isn't quite what Monty was implying I think.
 

LTig

Master Contributor
Forum Donor
Joined
Feb 27, 2019
Messages
5,833
Likes
9,573
Location
Europe
It's the analog reconstruction filter which removes the high frequency components (the "step" part) of the signal coming out of the DAC chip.
 

voodooless

Grand Contributor
Forum Donor
Joined
Jun 16, 2020
Messages
10,403
Likes
18,363
Location
Netherlands
It's the analog reconstruction filter which removes the high frequency components (the "step" part) of the signal coming out of the DAC chip.
… if you’re lucky.

Here is some info on why sample-and-hold is fundamentally wrong:


Best to first dig into on how the sampling theorem works as well.
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,894
Likes
16,710
Location
Monument, CO
But if each bit is being mapped to a discrete voltage, isn't that in fact a stairstep signal?

Monty's video showed the post-DAC signal as a perfect sine wave with no stair stepping. I think he even said that the smoothness isn't even due to filtering a stair step. He made it sound like the DAC chip can literally somehow fit the correct curve to the sample points and output it smoothly.
Each bit is mapped to a specific voltage no matter the DAC architecture. The output will be a stairstep at the output of the DAC, but in this context the DAC is the actual converter circuit. To an audiophile, the DAC is a box that includes the input buffer, clock recovery and digital pre-filters, DAC itself (often a highly-integrated chip), and output anti-imaging filter (often along with a bunch of other stuff). The output anti-image filter is required to remove all frequencies above Nyquist, 1/2 the sampling rate. That gets rid of the steps and the images at the DAC's output. A delta-sigma, or any oversampled design, can use a much smoother (lower-order) roll off above the audio band but the final effect will be the same: smoothed analog output with no stair steps.

There are a number of articles on ASR about ADC/DAC background and such; see the list in my signature as well as this thread and hopefully others from @NTK. My articles cover the basics of sampling and DAC reconstruction but I did not include the output filter in my basic model (at least I don't think I did, didn't go back and look, lazy). Filter design is a big subject and my stuff was just to introduce the basics.

HTH - Don
 

RayDunzl

Grand Contributor
Central Scrutinizer
Joined
Mar 9, 2016
Messages
13,250
Likes
17,192
Location
Riverview FL
Monty's video showed the post-DAC signal as a perfect sine wave with no stair stepping

16 bit samples gives up to 32,767 positive and 32768 negative "steps".

24 bit samples gives up to 8,388,607 positive and 8,388,608 negative "steps".

Is the resolution of your display able to discern those variations?

My monitor has only 1600 pixels (steps) vertically, giving at most (full screen) +/- 800 steps, so, I suppose there should be some jaggies present merely due to the display resolution, but I rarely notice even those crude steps.
 
Last edited:

antcollinet

Master Contributor
Forum Donor
Joined
Sep 4, 2021
Messages
7,713
Likes
13,023
Location
UK/Cheshire
16 bit samples gives up to 32,767 positive and 32768 negative "steps".

24 bit samples gives up to 8,388,607 positive and 8,388,608 negative "steps".

Is the resolution of your display able to discern those variations?

My monitor has only 1600 pixels (steps) vertically, giving at most (full screen) +/- 800 steps, so, I suppose there should be some jaggies present merely due to the display resolution, but I rarely notice even those crude steps.
But again, the output of a properly designed dac has NO steps whatsoever - regardless of bit depth. The reconstruction filter can perfectly restore the original smooth signal.

All increased bit depth gives you is a lower noise floor.
 

fpitas

Master Contributor
Forum Donor
Joined
Jul 7, 2022
Messages
9,885
Likes
14,212
Location
Northern Virginia, USA
But if each bit is being mapped to a discrete voltage, isn't that in fact a stairstep signal?

Monty's video showed the post-DAC signal as a perfect sine wave with no stair stepping. I think he even said that the smoothness isn't even due to filtering a stair step. He made it sound like the DAC chip can literally somehow fit the correct curve to the sample points and output it smoothly.
No DAC chip can output a smooth signal. But after low-pass filtering, it can come very close. I suppose one could consider the filter as part of a correctly designed DAC.
 

fpitas

Master Contributor
Forum Donor
Joined
Jul 7, 2022
Messages
9,885
Likes
14,212
Location
Northern Virginia, USA

txbdan

Active Member
Joined
Apr 21, 2020
Messages
213
Likes
199
NTK's first post in this thread describes sync interpolation. It showings that storing and even processing audio information in discrete time works very well. But this applies to digital processors and DSPs and has nothing to do with how DACs work. (and that is the intent of his post which is fine)

What got me thinking is Monty's video here:
. It comes right out of the gate saying that post-DAC digital audio is not stair-stepped. Is his point simply that its stair-stepped but then filtered to be smooth? If so, wouldn't that be much simpler to just say that? But even using a 3bit sample rate example, he shows the output as totally smooth:

He then goes onto explain how given two sample points per period (Nyquist) there is only one sine wave solution that fits the samples. This is of course true and explains how digital signal processing works accurately, but my question is how the heck does the DAC do this? A DAC isn't "smart" enough to curve fit sine wave to data points or event to do sync interpolation as far as I know.

Ok, maybe the DAC doesn't and it does produce stair steps which have a lot of high frequency content. If we LPF the output, the steps soften and soften until things are mostly smooth. But wouldn't we need an extremely tight bandpass filter centered at the fundamental to produce a perfect sine wave? But how would that filter work for broadband music?

If the answer is simply that if the resolution is high enough, then the steps are small enough, and we can smooth most of it out with filters, and that distortion is well below human hearing.. I get it. But if that's the case, why doesn't the video say that? I feel like there is some point in the video that I'm not getting that allows this to work even better than that.
 
Last edited:

voodooless

Grand Contributor
Forum Donor
Joined
Jun 16, 2020
Messages
10,403
Likes
18,363
Location
Netherlands
It comes right out of the gate saying that post-DAC digital audio is not stair-stepped.
Correct, at least current delta sigma DAC’s
Is his point simply that its stair-stepped but then filtered to be smooth? If so, wouldn't that be much simpler to just say that?
It would be simpler, but wrong ;)
He then goes onto explain how given two sample points per period (Nyquist) there is only one sine wave solution that fits the samples. This is of course true and explains how digital signal processing works accurately, but my question is how the heck does the DAC do this? A DAC isn't "smart" enough to curve fit sine wave to data points or event to do sync interpolation as far as I know.
It oversampling the audio to a much higher rate, like 8x to 128x. This is done by adding zero samples in between the real ones. All that is then needed is a low pass to “fill-in” the zero samples. This will then reconstruct you pretty sine wave. The quality of the reconstruction depends on the properties of the filter.

Next one can put this data into a (multi-bit) delta-sigma modulator. These do not generate stair steps and need little analog filtering.

An R2R DAC will generate steps though. These have to be filtered in the analog domain.
Ok, maybe the ADC doesn't and it does produce stair steps which have a lot of high frequency content.
An ADC does not. The sample values they sample are only valid for the sample moment, not the whole same period.

Best to forget steps altogether.. they are a wrong representation of digital audio.
 

fpitas

Master Contributor
Forum Donor
Joined
Jul 7, 2022
Messages
9,885
Likes
14,212
Location
Northern Virginia, USA
NTK's first post in this thread describes sync interpolation. It showings that storing and even processing audio information in discrete time works very well. But this applies to digital processors and DSPs and has nothing to do with how DACs work. (and that is the intent of his post which is fine)

What got me thinking is Monty's video here:
. It comes right out of the gate saying that post-DAC digital audio is not stair-stepped. Is his point simply that its stair-stepped but then filtered to be smooth? If so, wouldn't that be much simpler to just say that? But even using a 3bit sample rate example, he shows the output as totally smooth:

He then goes onto explain how given two sample points per period (Nyquist) there is only one sine wave solution that fits the samples. This is of course true and explains how digital signal processing works accurately, but my question is how the heck does the DAC do this? A DAC isn't "smart" enough to curve fit sine wave to data points or event to do sync interpolation as far as I know.

Ok, maybe the ADC doesn't and it does produce stair steps which have a lot of high frequency content. If we LPF the output, the steps soften and soften until things are mostly smooth. But wouldn't we need an extremely tight bandpass filter centered at the fundamental to produce a perfect sine wave? But how would that filter work for broadband music?

If the answer is simply that if the resolution is high enough, then the steps are small enough, and we can smooth most of it out with filters, and that distortion is well below human hearing.. I get it. But if that's the case, why doesn't the video say that? I feel like there is some point in the video that I'm not getting that allows this to work even better than that.
When any smoothed stairsteps are in the noise floor, that's pretty much perfection.
 

antcollinet

Master Contributor
Forum Donor
Joined
Sep 4, 2021
Messages
7,713
Likes
13,023
Location
UK/Cheshire
Correct, at least current delta sigma DAC’s

It would be simpler, but wrong ;)

It oversampling the audio to a much higher rate, like 8x to 128x. This is done by adding zero samples in between the real ones. All that is then needed is a low pass to “fill-in” the zero samples. This will then reconstruct you pretty sine wave. The quality of the reconstruction depends on the properties of the filter.

Next one can put this data into a (multi-bit) delta-sigma modulator. These do not generate stair steps and need little analog filtering.

An R2R DAC will generate steps though. These have to be filtered in the analog domain.

An ADC does not. The sample values they sample are only valid for the sample moment, not the whole same period.

Best to forget steps altogether.. they are a wrong representation of digital audio.
OK - so my understanding is faulty also.

So the oversampling and low pass filtering is done in the digital domain - correct?

But then you still have a sampled signal - (say 5.6448 Msamples/s for 44.1K 128x oversampled). Which must be output from the DAC Chip before going into an analogue reconstruction (low pass) filter? Correct?

So what is that waveform - a series of voltage "spikes" At each sample time? Or a 'held' voltage from one sample to the next (stair stepped)?
 

voodooless

Grand Contributor
Forum Donor
Joined
Jun 16, 2020
Messages
10,403
Likes
18,363
Location
Netherlands
So the oversampling and low pass filtering is done in the digital domain - correct?
Yes
But then you still have a sampled signal - (say 5.6448 Msamples/s for 44.1K 128x oversampled). Which must be output from the DAC Chip before going into an analogue reconstruction (low pass) filter? Correct?
Yes
So what is that waveform - a series of voltage "spikes" At each sample time? Or a 'held' voltage from one sample to the next (stair stepped)?
That depends on whatever does that job. An R2R DAC will output a stepped waveform, a delta sigma DAC will output a 1 bit PWM signal.
 

antcollinet

Master Contributor
Forum Donor
Joined
Sep 4, 2021
Messages
7,713
Likes
13,023
Location
UK/Cheshire
Yes

Yes

That depends on whatever does that job. An R2R DAC will output a stepped waveform, a delta sigma DAC will output a 1 bit PWM signal.
Thanks

*wanders off to read up more on delta sigma converters*
 

voodooless

Grand Contributor
Forum Donor
Joined
Jun 16, 2020
Messages
10,403
Likes
18,363
Location
Netherlands
Thanks

*wanders off to read up more on delta sigma converters*
For completeness here are some RAW waveforms from these DACs:
1661535306191.jpeg

Yeah.. it looks awful, but in the end it all works out ;)
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,894
Likes
16,710
Location
Monument, CO
So the oversampling and low pass filtering is done in the digital domain - correct?
For a delta-sigma DAC oversampling is part of the design and yes is digital. The very steep low-pass filtering is also done digitally. There is still an output anti-imaging filter on the analog output but, since the sampling rate is well above the audio band, it can be fairly simple (low order).

You can also oversample an R2R (etc. "conventional") DAC and add digital filters before the conversion to analog, followed by a low-order anti-imaging filter. I have not seen this done very often, but again audio is not my day job.

I realize my earlier answer was about conventional DACs. Delta-sigma designs output a fast (oversampled) pulse stream so you will not see conventional stair steps at its output. It still passes through discrete (fixed) steps, however, just harder to actually see them since a lot of filtering happens prior to the first analog output so initial smoothing is done "inside the box".

But then you still have a sampled signal - (say 5.6448 Msamples/s for 44.1K 128x oversampled). Which must be output from the DAC Chip before going into an analogue reconstruction (low pass) filter? Correct?
Yes. But what the signal looks like depends upon the DAC's architecture.

So what is that waveform - a series of voltage "spikes" At each sample time? Or a 'held' voltage from one sample to the next (stair stepped)?
There are special DACs that create quasi-impulse outputs, but usually (vast majority IME) a conventional DAC will create steps (like stair steps) at the output before the filter. A delta-sigma creates a pulse train (typically PCM signal) so toggles between "1" and "0" with varying pulse widths.

The classic intro for me was an IEEE book (tutorial and collection of papers) edited by one of my early teachers: Oversampling Delta-Sigma Data Converters by James C. Candy and Gabor C. Temes. There was what many considered a follow-on text years later with more information and practical background: Delta-SIGMA Data Converters: Theory, Design, and Simulation, by Norsworthy, Schreier, and Temes -- I no longer have that one (borrowed and never returned, arrrgh!!!) There are many others, natch, since these were early 1990's books, but they have the basics.

These articles show conventional DACs: https://www.audiosciencereview.com/forum/index.php?threads/digital-audio-sampling-101.1919/ and https://www.audiosciencereview.com/...ital-audio-converters-dacs-fundamentals.1927/

Delta-sigma DACs here: https://www.audiosciencereview.com/...ital-audio-converters-dacs-fundamentals.1927/ -- I did not include time-domain pictures, looking back a major oversight, but @JohnYang1997 added some plots that make it clear.

Hard to believe some of those early posts are more than 10 years old, and original articles are from papers I gave over 20 years ago. Blah.

HTH - Don

Edit: @voodooless already answered, I'm late to the party again, oh well... :(
 

antcollinet

Master Contributor
Forum Donor
Joined
Sep 4, 2021
Messages
7,713
Likes
13,023
Location
UK/Cheshire
For a delta-sigma DAC oversampling is part of the design and yes is digital. The very steep low-pass filtering is also done digitally. There is still an output anti-imaging filter on the analog output but, since the sampling rate is well above the audio band, it can be fairly simple (low order).

You can also oversample an R2R (etc. "conventional") DAC and add digital filters before the conversion to analog, followed by a low-order anti-imaging filter. I have not seen this done very often, but again audio is not my day job.

I realize my earlier answer was about conventional DACs. Delta-sigma designs output a fast (oversampled) pulse stream so you will not see conventional stair steps at its output. It still passes through discrete (fixed) steps, however, just harder to actually see them since a lot of filtering happens prior to the first analog output so initial smoothing is done "inside the box".


Yes. But what the signal looks like depends upon the DAC's architecture.


There are special DACs that create quasi-impulse outputs, but usually (vast majority IME) a conventional DAC will create steps (like stair steps) at the output before the filter. A delta-sigma creates a pulse train (typically PCM signal) so toggles between "1" and "0" with varying pulse widths.

The classic intro for me was an IEEE book (tutorial and collection of papers) edited by one of my early teachers: Oversampling Delta-Sigma Data Converters by James C. Candy and Gabor C. Temes. There was what many considered a follow-on text years later with more information and practical background: Delta-SIGMA Data Converters: Theory, Design, and Simulation, by Norsworthy, Schreier, and Temes -- I no longer have that one (borrowed and never returned, arrrgh!!!) There are many others, natch, since these were early 1990's books, but they have the basics.

These articles show conventional DACs: https://www.audiosciencereview.com/forum/index.php?threads/digital-audio-sampling-101.1919/ and https://www.audiosciencereview.com/...ital-audio-converters-dacs-fundamentals.1927/

Delta-sigma DACs here: https://www.audiosciencereview.com/...ital-audio-converters-dacs-fundamentals.1927/ -- I did not include time-domain pictures, looking back a major oversight, but @JohnYang1997 added some plots that make it clear.

Hard to believe some of those early posts are more than 10 years old, and original articles are from papers I gave over 20 years ago. Blah.

HTH - Don

Edit: @voodooless already answered, I'm late to the party again, oh well... :(
No probs - the more times I read it, and the more words used, the better chance I have of some of it sinking in :D
 

LTig

Master Contributor
Forum Donor
Joined
Feb 27, 2019
Messages
5,833
Likes
9,573
Location
Europe
Just as a reminder: It's not the output of the DAC chip which matters but the output of the whole device. Searching for stair steps at the output of the chip is futile and tells us nothing about what comes out of the device at its analog output.

DAC devices implement a reconstruction filter behind the output of the DAC chip which is required to output the same signal as was digitized earlier. This is what Monty shows in his great video.

Devices without a reconstruction filter I consider as broken per design, and the designer has not understood how digital audio works.
 
Top Bottom