• 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!

Trying to understand DAC accuracy.

KarlM

New Member
Joined
Apr 18, 2023
Messages
2
Likes
0
There are lots of DACs that advertise S/N ratios of 100dB or better and I'm trying to understand how that's possible.

Here's my confusion:

According to the Whittaker–Shannon interpolation formula, we can exactly reconstruct an analog signal as:
- Sum x[n] sinc(n - t/T)
where the sum extends to infinity in both directions. Real-world DACs need to truncate the sum into a finite (and typically short) window for both computational and latency reasons. This introduces error. In general, there's no way to reduce this error because it depends on the values of x[n] that the DAC doesn't have. Using a windowing function (e.g. the Blackman window) can improve the frequency distribution of the error, but actually increases the error.

To estimate the error, I'm going to assume a sample rate of 48kHz and a window of 32 samples on each size, resulting in a latency under 1ms. In that case, the size of the first term omitted from the sum is of the order of x[n] / 32 pi, which is only 40dB lower than x[n]. There is some cancellation between adjacent terms, as the sinc function changes signs, but it won't reduce the error nearly enough to get it below -100dB.

I can think of two possible explanations here. The first is that the way that the S/N ratio of a DAC is measured doesn't capture this error. The second is that DACs produce very little error for common test signals, but not for arbitrary signals. This seems quite plausible when the sampling rate is a multiple of the test signal frequency.

Can someone explain what is going on? Am I missing something here?

Thank you.
 

BDWoody

Chief Cat Herder
Moderator
Forum Donor
Joined
Jan 9, 2019
Messages
7,084
Likes
23,560
Location
Mid-Atlantic, USA. (Maryland)
Monty is usually a good place to start when it comes to sampling theory basics.

 

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,720
Likes
6,014
Location
US East
Welcome to ASR!

The sinc function is simply the impulse response of a perfect/ideal brickwall filter with its cutoff at the Nyquist frequency. Convolving the signal with it is therefore simply filtering the signal with this ideal brickwall filter.

Now, the question in the real world is what happens if we don't want to convolve our signal with an infinitely long impulse response (the filter kernel). The ideal filter (but with an infinitely long filter kernel) has a zero width transition zone from passband to stopband. A non-ideal finite length filter kernel is going to have a finite width transition zone and also less than perfect attenuation in the stopband.

To quote DSPGuide, if you have signals that are A/D converted from analog, the requirement of anti-alias filtering means that the width of the transition zone is determined by the analog side of the signal chain.
https://www.dspguide.com/ch3/4.htm
dspbook_ch_3_4.png


For CD sampling rates, that usually means the transition zone is from 20 to 22.05 kHz. For a signal to "reflect" (or image) back to 20 kHz, its frequency will be 24.1 kHz (since the Nyquist "mirror" point is 22.05 kHz). Therefore, the transition zone from passband to stopband for the digital reconstruction filter is 20 - 24.1 kHz, which is pretty generous for a digital filter. That's why pretty much nobody except "audiophiles" will think the digital reconstruction filter is still a problem that deserves attention.

To analyze a shortened sinc function (by multiplying it with a window function) as a filter kernel, one can look in the frequency domain. Since multiplication in the time domain corresponds to convolution in the frequency domain, and vice versa, to determine the frequency response of the windowed sinc function, simply convolve the Fourier transform of the sinc function with the Fourier transform of the window function.
 

pjug

Major Contributor
Forum Donor
Joined
Feb 2, 2019
Messages
1,776
Likes
1,562
Here is a paper that gets to the question, in a way.
 
OP
K

KarlM

New Member
Joined
Apr 18, 2023
Messages
2
Likes
0
Thanks for the responses.

So if I understand correctly, replacing the sinc with something of finite duration can be seen as changing from an ideal filter to something that can actually be realized in hardware. This then results in some noise above the Nyquist frequency and a non-flat frequency response below it. However we don't include either of these effects in our measurements of THD+N or SINAD. That mostly makes sense to me, since everything above Nyquist is going to be inaudible and we don't hear small variations in frequency response very well.

Looking at the specs of the PCM1794A referenced in the paper, for the slow filter, there's a ripple of 0.00001dB up to 0.454fs (=20kHz for CD sampling rates) and then a roll-off reaching -3dB at 0.49fs, eventually reaching -130dB attenuation. All of these are going to be completely inaudible, but they do cause the DAC to produce an output that differs from a perfect reconstruction, with the ripple causing an error around -56dB by my calculations. That seems to be the error I was looking for that isn't included in the noise measurements.

Thanks.
 

charleski

Major Contributor
Joined
Dec 15, 2019
Messages
1,098
Likes
2,240
Location
Manchester UK
I can think of two possible explanations here. The first is that the way that the S/N ratio of a DAC is measured doesn't capture this error. The second is that DACs produce very little error for common test signals, but not for arbitrary signals. This seems quite plausible when the sampling rate is a multiple of the test signal frequency.
I'd recommend chapter two of Ken Pohlman's book.
For a large signal, the quantisation error becomes uniformly distributed and can be treated as noise. This leads to the 6.02n+1.76dB signal-to-error equation. But for small signals, the error becomes correlated with the signal and thus is better treated as distortion. Certain signals can produce errors that will be readily audible (usually through aliasing). The way to handle that is to use dither, which adds broadband noise but decorrelates the error and prevents the formation of audible artifacts.
 

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,720
Likes
6,014
Location
US East
Thanks for the responses.

So if I understand correctly, replacing the sinc with something of finite duration can be seen as changing from an ideal filter to something that can actually be realized in hardware. This then results in some noise above the Nyquist frequency and a non-flat frequency response below it. However we don't include either of these effects in our measurements of THD+N or SINAD. That mostly makes sense to me, since everything above Nyquist is going to be inaudible and we don't hear small variations in frequency response very well.

Looking at the specs of the PCM1794A referenced in the paper, for the slow filter, there's a ripple of 0.00001dB up to 0.454fs (=20kHz for CD sampling rates) and then a roll-off reaching -3dB at 0.49fs, eventually reaching -130dB attenuation. All of these are going to be completely inaudible, but they do cause the DAC to produce an output that differs from a perfect reconstruction, with the ripple causing an error around -56dB by my calculations. That seems to be the error I was looking for that isn't included in the noise measurements.

Thanks.
You've confused the "errors " of a filter with nonlinear distortions (as in harmonic distortions). An ideal reconstruction (low pass) filter has a perfect unity gain in the passband, transitions immediately to the stopband at the cutoff frequency, and attenuates the stopband to the noise floor.

The errors from non-ideal filter are amplitude errors, i.e. it deviates from the FR curve of the ideal filter -- not unity gain (e.g. ripples) in the passband, a non-zero width transition band with less than infinite slope roll-off, and less than perfect attenuation too the noise floor in the stopband. (A non-linear phase filter also introduces phase errors.) The non-ideal filters, however, do not introduce harmonics, and therefore does not add to THD.

Go back to your -56 dB error. The effect of it is an amplitude error in the reproduce signal. If you compute the (incoherent) sum of a 0 dB signal and a -56 dB signal, here is what you'll get:
Original component: 0 dB -> amplitude = 1.0​
Error component: -56 dB -> amplitude = 10^(-56/20) = 0.00158489​
Incoherent amplitude sum = square root of sum of squares = sqrt(1.0^2 + 0.00158489^2) = 1.000001256​
Convert back to dB -> 20 * log10(1.000001256) = 0.00001 dB​

Which equals to, may be purely by coincident, the slow filter passband ripple spec per TI.
 
Last edited:

pjug

Major Contributor
Forum Donor
Joined
Feb 2, 2019
Messages
1,776
Likes
1,562
for the slow filter, there's a ripple of 0.00001dB up to 0.454fs (=20kHz for CD sampling rates)
Minor point, but this is the spec on the sharp filter I think. The slow filter spec is 0.001dB ripple. But the sharp filter delay is still only barely longer than the 1ms in your original post.
 

DVDdoug

Major Contributor
Joined
May 27, 2021
Messages
3,038
Likes
4,005
Our ears are also "highly-imperfect". ;)

The ONLY time I've heard a defect from ANY "DAC", it was a noisy soundcard... I could hear noise in my headphones when the hard drive was accessed. The was noise obviously getting into the analog-side of soundcard (not a "digital" problem).
 
Top Bottom