DAC Reconstruction Filter Talk and Other Stuff

Discussion in 'Random Thoughts' started by Garns, Jan 20, 2017.

  1. Garns

    Garns Friend

    Pyrate
    Joined:
    Jul 9, 2016
    Likes Received:
    2,484
    Trophy Points:
    93
    Location:
    Sydney, AUS
    I don't understand. I'm a DSP bozo, but I thought a perfect digital reconstruction filter should have impulse response that looks like a sinc function. Yggdrasil impulse looks pretty much like a sinc function. Shouldn't that just result in a correctly band limited signal with flat FR, rather than ringing?
     
  2. briskly

    briskly Friend

    Pyrate
    Joined:
    Oct 3, 2015
    Likes Received:
    59
    Trophy Points:
    18
    Location:
    New York
    Hmm.
    Quantization artifacts aren't the easiest fit to the measurement. Time domain blip with 24-bit input is only obvious at zero-crossing instead of all bits.

    The filter does make for a good reconstruction as you piece together the continuous signal. It rings in that the impulse response shows a slow decaying oscillation (a sinc-like function), not so much that it adds ringing to whatever other signal you input.
    Steep transitions in one Fourier term (e.g. frequency) are reflected by slower transitions in the opposite term (e.g. time), and vice versa.
     
  3. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,960
    Trophy Points:
    113
    Location:
    Irvine CA
    Yup. Yesterday I remembered I asked @atomicbob about the zero crossing blip. He said it likely was crossover distortion. Which makes more sense to me.

    "Ringing" means the signal (or filter) is band limited, hopefully flat in the audio band and rejecting everything else.

    An audio band sinc like filter will pass audio band signals through almost untouched.

    If an input signal to an audio sinc like filter has a frequencies above the audio range, well, the output might "ring". It is the result of filtering the ultrasonics.

    A broadband step, impulse, or square wave has ultrasonics, and the filter removal of these ultrasonics will look like "ringing" in the time domain.
     
  4. Garns

    Garns Friend

    Pyrate
    Joined:
    Jul 9, 2016
    Likes Received:
    2,484
    Trophy Points:
    93
    Location:
    Sydney, AUS
    Good, thanks, so "ringing" just refers to the correct behaviour of a digital reconstruction filter.

    Ok, now I am confused again. The input to the reconstruction filter is, I guess, an impulse train, and by the Nyquist theorem, every such impulse train represents a unique band-limited signal. If you naively sample a synthetic square (or saw, triangle or step) wave then sure you will not get it back again after reconstruction because you failed to band-limit your input signal. But the error on reconstruction would be aliasing of the harmonics above Nyquist into the available bandwidth which would potentially look like a total inharmonic mess.

    On the other hand if you did correctly band limit your input signal then wouldn't you have Gibbs phenomenon/ringing at the discontinuities just because that is what the band-limiting of a square wave looks like?

    Tl;dr, isn't ringing always a sign that you have designed your system correctly?
     
  5. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,960
    Trophy Points:
    113
    Location:
    Irvine CA
    I don't think have to worry about aliasing on a DAC (only on an ADC). Unless one is doing decimation in the digital domain.

    I think the chain of events is:

    Upsample/zero insertion (digital) -> interpolation filter (digital) -> sample/hold (analog) -> reconstruction filter (analog)

    The sample/hold operation may introduce some roll off, so the interpolation filter (digital) may incorporate some compensation.

    I believe the Gibbs phenomenon/ringng you see is due mostly to the interpolation filter (digital) and that IMO is a good sign.
     
  6. Andre Y

    Andre Y Friend

    Pyrate
    Joined:
    Oct 4, 2015
    Likes Received:
    220
    Trophy Points:
    43
    Location:
    Southern California
    Upsampling in the digital domain can cause aliasing too. Since the original signal is now represented by a train of impulses, it's turned into a signal that has energy above Nyquist: those are all the images of the baseband signal repeating to +- infinity. The interpolation filter in an up/oversampling filter has to lowpass filter the signal to less than Nyquist of the new sampling rate. For example, upsampling 44.1 kHz to 88.2 kHz, the upsampling filter has to bandwidth limit the 44.1 kHz sample stream to less than 44.1 kHz before doing the 88.2 kHz upsampling. A signal sampled at 44.1 kHz has aliases or copies of the baseband signal centered at every integer multiple of 44.1 kHz, so it has to be bandwidth limited before resampling otherwise those repeated images will alias into the audible bandwidth.

    Quantization error, like chopping off the lowest bits of a sample word without dither, will also cause aliasing since that's a very non-linear discontinuous process that can produce high frequency energy (you are basically creating stairsteps in the signal). Those weird, low-level spikes below the noisefloor in the Stereophile measurements may be an artifact of this, but that's only a guess based on the limited information available.

    Filter overload is another thing in a DAC that may cause aliasing. A while ago, the guys at TC Electronic wrote a paper that showed how highly compressed signals (in the loud radio ad sense, not in the MP3 sense) can cause peaks in the reconstructed signal well above 0 dBFS which can latch up or otherwise screw with digital filters unprepared to handle this. Here's a link to the paper if you're curious: http://www.tcelectronic.com/media/1018207/nielsen_lund_2000_0dbfs_le.pdf

    In other words, even if your actual sample points are all below the maximum digital level of your filter, they can represent a signal which is higher than the max digital level in between the sample points. This is easy to imagine: think of a sine wave, and think of sampling the sine wave only at its lower amplitude points. When reconstructed, you're going to get a signal which has points that are higher than your original sample point.

    When those in-between peaks are reconstructed, they present a higher than expected signal to whatever is downstream of the interpolater, and that can cause all sorts of issues especially on a signal that's so compressed that all of its sample points live near the peak digital level. I had a surround processor once whose surround sound matrixing algorithm (which worked in the digital domain) would get latched up by a certain song track. The TC Electronic paper has examples of more straightforward DACs whose filters were screwed up badly by highly compressed signals. Once your DSP algorithm goes non-linear, it can generate all sorts of out-of-band energy that's aliased, and so becomes more audible.

    This is the phenomenon that Benchmark's DAC-2 and now DAC-3 claim to guard against when they talk about their high-headroom DSP.

    BTW, this is why digital level meters that look at sample values only are worthless. You have to look at the interpolated values between the sample points to get a true sense of a signal's peak levels. It's also why simplistic methods of determining when a digital signal has overloaded (eg. 5 consecutive max samples values) are often wrong too.
     
  7. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,960
    Trophy Points:
    113
    Location:
    Irvine CA
    I agree that one does need an interpolation filter. But I think those things that you are calling aliases, are usually called images. I don't think they are the same thing. (*NOT trying to use condescending tone here, I mean what I say*)

    Also one cannot have energy above the Nyquist in the digital domain. One can cross clock domains and have different Nyquists perhaps (one in each clock domain).

    Furthermore, in the digital domain there are no baseband signals repeating to +/- infinity, unless the clock is infinitely fast. Which is not going to happen. Note Dirac delta functions don't exist in the real world, because I don't think we have ever observed a signal with infinite bandwidth.

    I don't think adding noise and/or dithering in the digital domain will cause aliasing. Residual noise in the analog domain can alias during sampling, but I think quantization is sort of a slightly different animal.

    That makes sense. I don't want to sound pedantic, but to me it's kind of obvious. However, I don't think that is aliasing either.

    That is just how things will behave because things are band limited and operating outside of their linear region. Filtering can definitively do what you are describing when signal is compressed. Seen it many times. That AFAIK results in good old distortion though.

    Makes sense. Not entirely worthless IMO though.

    In summary, I could be wrong, but I think you are stretching the definition or idea of aliasing a little too much.

    I did like your comment about the Central Limit Theorem because the proof might involve some averaging intuition. And you do seem to grasp the concepts well.
     
    Last edited: Jan 23, 2017
  8. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,960
    Trophy Points:
    113
    Location:
    Irvine CA
    Let me explain a bit more where I'm coming from.

    Aliasing as far as I know is the fold over of frequencies above the Nyquist during a sampling or decimation process. Nyquist here is relative to the sampled or decimated signal sampling rate.

    Images arise from inserting zeros while upsampling. In the frequency domain these images do not fold over on top of signal. One may visualize the zero insertion together with the increase in sampling as a compression of the signal bandwidth (relative to Nyquist), and the addition of frequency domain replicas. As you described. The replicas do not overlap nor fold over the original signal bandwidth.

    In sampling and decimation, one applies a decimation filter BEFORE sampling or decimation to avoid aliasing. In interpolation, one applies the interpolation filter AFTER zero insertion to remove the images, which in the time domain amounts to filling the signal gaps due to zero insertion. In multirate signal processing one can reverse some of these operations, but that's another story.

    On a DAC, usually one incorporates an interpolation operation. There maybe decimation however in cases where the rates of the input and output signals are not integer multiples of eachother. Furthermore, there are analog reconstruction filters that do not smooth out impulses, or zero insertions, but S/H stair case approximations from the DAC output.

    Whatever. Who cares. Back to listening tunes before snoozing.
     
    Last edited: Jan 23, 2017
  9. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,960
    Trophy Points:
    113
    Location:
    Irvine CA
    Moreover, moved this discussion here. Seems appropriate.
     
  10. yotacowboy

    yotacowboy McRibs Kind of Guy

    Pyrate Contributor
    Joined:
    Feb 23, 2016
    Likes Received:
    10,897
    Trophy Points:
    113
    Location:
    NOVA
    Home Page:
    just want to say thanks; this thread (or snippet...) is a perfect example of why SBAF is yummy. and moist.
     
  11. Garns

    Garns Friend

    Pyrate
    Joined:
    Jul 9, 2016
    Likes Received:
    2,484
    Trophy Points:
    93
    Location:
    Sydney, AUS
    Or indeed pretty much any kind of nonlinear signal processing in the digital domain!

    This was quite fun to try and figure out for myself. I think I got it by an argument like this:

    If I have a digital signal at 44.1kHz then I can view it as an analogue signal given by an impulse train at that frequency. The frequency domain transform of this signal is periodic with period 22.05kHz. To reconstruct the corresponding bandlimited signal I convolve with a sinc function which is the transform of a step function of width 22.05kHz.

    If I upsample to 88.2kHz by inserting zeros, then the analogue impulse train to which it corresponds stays *the same*, because I inserted zeros. And now to reconstruct the corresponding bandlimited signal at the new sample rate, I convolve with a sinc function which is the transform of a step function of width 44.1kHz. This kills all the repeating copies in the frequency domain except for the first *two*. So I get one extra image of the frequency domain response in the region 22.05-44.1kHz.

    Thinking about this also just brought home why one should care about the fact that the Schiit upsampling filter preserves the original sample values: because that is what's supposed to happen in the Nyquist theorem. It's sort of an amazing property for a convolution filter to have.
     
    Last edited: Jan 24, 2017
  12. anetode

    anetode Friend

    Staff Member Pyrate
    Joined:
    Sep 25, 2015
    Likes Received:
    479
    Trophy Points:
    93
    Location:
    How did I get here
    Home Page:
    Nice tangent! Agree re: alias/image distinction, don't really have anything useful to add, but it seems appropriate to link to http://src.infinitewave.ca/
     
  13. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,960
    Trophy Points:
    113
    Location:
    Irvine CA
    Well, upsampling, sampling, and downsampling are sort of non-linear operations. Just a little different.

    The period in the frequency domain would be 44.1 kHz. To reconstruct, the non-causal sinc should correspond to a frequency domain rectangular function going from -22.05 kHz to 22.05 kHz.

    The period in the frequency domain would now be 88.2 kHz. To reconstruct, the non-causal sinc should correspond to a frequency domain rectangular function going from -44.1 kHz to 44.1 kHz. But you can get away with anything between the previous width and -22.05 to +22.05 because there is not signal in between.

    This I think should kill all the images.
     
  14. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,960
    Trophy Points:
    113
    Location:
    Irvine CA
    Actually, for 88.2 kHz, I think you can get way with anything that is flat from -22.05 to 22.05 (passband), whatever you want from 22.05 to 66.15 (transition band), and nothingness from 66.15 and above (stop band)... and their equivalent negatives to keep things real.

    Which is why higher sampling rates make things easier for the analog reconstruction filter.

    That is not counting the fact that the reconstruction filter has to deal with a staircase approximation instead of impulses. The staircase puts a sinc envelope on the passband which gets streatched if you oversample and reduces rolloff.
     
  15. FallingObjects

    FallingObjects Pay It Forward

    Pyrate
    Joined:
    Oct 15, 2016
    Likes Received:
    2,235
    Trophy Points:
    93
    There are definitely words in this thread, and after careful examination I've determined that they're probably English.

    I've given trying to understand this stuff a good go, and I do want to learn, but does anyone want to point me to some good starting reading material so I can understand things being said here a bit better? When I try to search the terms on Google it pretty much dumps me in the deep end, and I can't seem to find the wading pool.
     
  16. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,960
    Trophy Points:
    113
    Location:
    Irvine CA
    LOL! It all started I think with these plots regarding the Yggdrasil from Stereophile:

    [​IMG]

    Regarding this plot JA said: "The Yggdrasil's impulse response with data sampled at 44.1kHz is shown in fig.1. Taken from the left channel's output, it reveals the Yggdrasil's reconstruction filter to be a time-symmetrical, finite-impulse-response type, but with more coefficients than is usually seen with this type of filter."

    Which IMO is awesome and deserves praise.

    [​IMG]

    Regarding the plot, JA said "With undithered data and a signal at exactly –90.31dBFS, the Yggdrasil output a superbly symmetrical waveform, with the three DC voltage levels described by the data very well defined and the ringing due to the reconstruction filter clearly visible."

    @Garns, asked the following:

    It results in a correctly bandlimited signal. The ringing happens because the 16-bit "tone" signal does not appear to be bandlimited to the audio range (i.e. it's not exactly a tone).

    The "undithered 1 kHz 16-bit tone" test, which seems to be typical in JA's characterization suite, appears to be more of a 1 kHz 3-level square wave (unlike the 24-bit test). Such a square wave is not audio bandlimited, and the internal digital interpolation filter (not the analog reconstruction filter), will bandlimit it with the end result being "ringing". This does not happen with the 24-bit case, because in that case, the signal seem to be bandlimited to the audio band correctly.

    In all cases, it shows the behavior of the sinc indeed. But it helps show how low in noise the Yggdrasil really is. This low noise and resolution performance is not unheard off, but it's indeed very good IMO.

    In other words, all is good.

    Then questions started to go down the path of aliasing and stuff like that, which is not required at all to enjoy your music and gear.
     
  17. anetode

    anetode Friend

    Staff Member Pyrate
    Joined:
    Sep 25, 2015
    Likes Received:
    479
    Trophy Points:
    93
    Location:
    How did I get here
    Home Page:
    A compendium of other assorted English words on the subject.
     
  18. Cspirou

    Cspirou They call me Sparky

    Pyrate
    Joined:
    Sep 27, 2015
    Likes Received:
    8,253
    Trophy Points:
    113
    Location:
    Northwest France
  19. FallingObjects

    FallingObjects Pay It Forward

    Pyrate
    Joined:
    Oct 15, 2016
    Likes Received:
    2,235
    Trophy Points:
    93
    Thanks guys! Gonna have me some reading to do.
     
  20. Andre Y

    Andre Y Friend

    Pyrate
    Joined:
    Oct 4, 2015
    Likes Received:
    220
    Trophy Points:
    43
    Location:
    Southern California
    Adding noise or dither is not non-linear: sorry, didn't mean to imply that if I did. However, quantization (chopping off the lowest bits) is non-linear, and any time you have a non-linear process in the digital domain, you can alias.

    The definition of linearity I'm using is the mathematical one we learned back in high school algebra:

    1. a*f(x) = f(a*x)
    2. f(a) + f(b) = f(a+b)

    How non-linearities can cause aliasing can be seen if you take some non-linear function like f(x) = x^2, and put x=sin(t) into it. Work through the trig identities, and you generate sin(2*t) terms, which are sine waves twice the frequency of the original signal. Similarly any power function will generate harmonics that are multiples of the highest powers: something with x^4 terms will generate 4th harmonics or sines with 4x frequency. You can see how with higher frequency sines, you can easily exceed the Nyquist limit of a sampled system.

    Power series non-linearities show up in lots of signal processing too: level compression and limiting systems are inherently non-linear, and so often use oversampled algorithms to contain their non-linearities, eg. the compression process is run at 2x or 4x or higher sample rates.

    In the case of undithered quantization, it's introducing a sharp discontinuity in the waveform by chopping the lowest bits off. Sharp discontinuities contain higher frequencies, and high frequencies will cause aliasing if they're above Nyquist. Undithered quantization also does not fulfill the linearity rules above.
     

Share This Page