7
$\begingroup$

I'm trying to form my own understanding on the religious war around using 192kHz as a sampling rate for playback (the Internet seems to have a wealth of material on both sides). I'm struggling to understand how reconstruction filters work.

The Nyquist-Shannon sampling theorem, often cited by the anti-192 camp, basically states that a 44.1kHz sample rate is sufficient to reconstruct without loss a band-limited signal of 20kHz. However, when looking at the Whittaker–Shannon interpolation formula, it seems to me that an ideal reconstruction filter would need to have access to all samples, i.e., all past and all future samples.

I'm not an expert in analog audio, but I doubt that such a device can be built. I would assume that, at best, a delay can be introduced to "wait" for enough future samples to arrive, so that the contribution of unavailable future samples to the current output instant becomes negligible.

Can someone explain how practical reconstruction filters work and what are their tradeoffs? Is there a theoretically stricter limit to the Nyquist-Shannon theorem if only a window of samples is available or if reconstruction latency is unacceptable?

$\endgroup$
1
$\begingroup$

By allowing an increase in the delay introduced by a digital oversampling filter, the other characteristics of the filter, pass band and stop band ripple and transition band width, can be improved to be arbitrarily close to zero. The oversampling factor can be increased to widen the stop band and to relax requirements on analog filtering, resulting in an increased computational complexity but no significant increase in the delay time introduced by the filter.

Audio DAC's typically have a digital oversampling filter selectable between a low time-delay (latency) filter and a sharp frequency response roll-off filter. The low-delay filter may be a minimum-phase filter or a psychoacoustically tuned compromise between low dispersion (some frequencies being delayed more than others) and low effective delay. The sharp roll-off filter is typically a linear-phase filter with a symmetrical impulse response and a specified maximum ripple in the pass band and in the stop band. This kind of a specification is easy to express in a datasheet and to incorporate in a system design. Comparable equiripple linear-phase filters can be designed in Octave using remez, here with equal weight of pass band and stop band ripple:

pkg load signal
x2x = []; x4x = [];
for n = [16:86]
  b2x = remez(2*n, [0, 20/44.1, (44.1-20)/44.1, 1], [1, 1, 0, 0], [1, 1], "bandpass", 128);
  b4x = remez(2*n, [0, 20/(44.1*2), (44.1-20)/(44.1*2), 1], [1, 1, 0, 0], [1, 1], "bandpass", 128);
  [h2x, w2x] = freqz(b2x); [h4x, w4x] = freqz(b4x);
  x2x = [x2x; (length(b2x)-1)/2/2, 20*log10(abs(h2x(end)))];
  x4x = [x4x; (length(b4x)-1)/2/4, 20*log10(abs(h4x(end)))];
endfor
plot(x2x(:,1), x2x(:,2), "x", x4x(:,1), x4x(:,2), "x", 29.2, -100, "x", 39.5, -110, "x", 43.3828125, -110, "x")
xlabel("group delay / f_s");
ylabel("stop band ripple (dB)");
text(29.2-2, -100-4, "AK4499");
text(39.5-2, -110+4, "CS43198");
text(43.3828125-2, -110-4, "AD1955");
grid on

The script designs various order filters (limited by what remez can handle without numerical problems) for a pass band from 0 to 20 kHz and a stop band starting at 24.1 kHz, to be operated at a small selection of oversampling sampling frequencies of 2 and 4 times the 44.1 kHz sampling frequency, and plots (Fig. 1) the stop band ripple characteristics together with those of equivalent oversampling digital filters of flagship audio DAC's from Asahi Kasei (AK4499), Analog Devices (AD1955), and Cirrus Logic (CS43198).

enter image description here
Figure 1. Stop band and pass band ripple for 2x (blue) and 4x (orange) oversampling remez-designed linear-phase low-pass digital filters with equal pass and stop band weights, as function of impulse response half-length in units of the sampling period at the 1x sampling frequency of 44.1 kHz. Also plotted are stop band ripple performance figures for a selection of DAC oversampling filters with the corresponding pass band ripple being specified as 5×10^-3 dB for the 8x oversampling digital filter of AK4499, 10^-2 dB for the combined digital and analog filter of CS43198, and 2×10^-4 dB for the 8x oversampling digital filter of AD1955. All filters compared here have identical transition band boundaries: 20 kHz to 24.1 kHz.

For 44.1 kHz sampling frequency, Fig. 1 gives a lower bound on linear-phase oversampling digital filter performance as function of delay introduced by the filter, when pass band and stop band ripple are equally weighted. This bound does not depend significantly on the oversampling ratio. DAC manufacturers may choose a different weighting for example to gain lower stop band ripple by increasing the pass band ripple, as in the case of AK4499. They may also optimize the filters by other criteria than strict equiripple. For example, the filter may include compensation for attenuation of high frequencies by the analog circuitry (zero-order hold, RC-filters, etc.), and the filter delay characteristics may suffer from using a computationally efficient multi-rate implementation.

We can have a closer look at the highest-performance filter in Fig. 1 which comes from remez(2*86, [0, 20/44.1, (44.1-20)/44.1, 1], [1, 1, 0, 0], [1, 1], "bandpass", 128), by plotting its impulse response (Fig. 2) and frequency response using freqz (Fig. 3):

enter image description here
Figure 2. Impulse response of the highest-performance linear-phase 2x oversampling filter from remez.

enter image description here
Figure 3. Frequency response of the highest-performance linear-phase 2x oversampling filter from remez.

It would be more interesting to look at 8x oversampling filters, but remez fails with error: remez: insufficient extremals--cannot continue.

$\endgroup$
  • $\begingroup$ you know; when something (audio system) sounds really good, then its explanation (data sheet) must do even better !.. :-) That's how they make it in commercial audio industry... ;-)) $\endgroup$ – Fat32 Aug 2 at 0:34
  • $\begingroup$ Wow! I need to re-read your answer a few more times to fully process it. Nice job! Just to confirm I got the gist of it, a high-quality DAC with digital oversampling introduces a delay of 0.6-1ms at a sampling frequency of 44.1kHz? $\endgroup$ – user1202136 Aug 2 at 14:19
  • $\begingroup$ @user1202136 yes that is correct, if the sharp roll-off filter is selected. $\endgroup$ – Olli Niemitalo Aug 2 at 18:58
3
$\begingroup$

The sampling theorem requires a perfectly bandlimited signal, bandlimited to below twice the sampling frequency. The problem with this is that only an infinite length signal (e.g. exists before the big bang) can be perfectly bandlimited. This is from the Fourier theorem regarding any domain with finite support.

Thus all real-world signals are imperfectly band-limited, limited by the length of the recording session and the duration of the impulse response of the low-pass filtering used before sampling (e.g. imperfect band-limiting). So you must assume a finite noise floor due to sample aliasing. Therefore your reconstruction also need be no better than this noise floor. Therefore you can window the perfect reconstruction formula to some reasonable finite duration. For audio, this window width can be limited to on the order of a small multiple of the period of the lowest frequency audible, as stuff before and after that can't affect audible pitch perception significantly (other stuff, such as masking and adaptive thresholding, etc., likely dominate).

The advantage of very high sample rates is that the aliased frequencies (due to imperfect pre-sampling filtering and post-sampling reconstruction) are even higher, and far less likely to be picked up by a physical microphone or pass with any significant magnitude (above the thermal noise floor, etc.) through the anti-aliasing filters. As other answers here detail, this also allows physically realizable filters to be flatter and have more linear phase response in generic 20-20k pass-band, and roll-off more approaching half the sample rate.

$\endgroup$
  • $\begingroup$ The suggested relationship between the window width and the lowest frequency audible is purely coincidental, right? $\endgroup$ – Olli Niemitalo Jul 31 at 9:47
2
$\begingroup$

A quick answer, but as human hearing does not go past 20kHz bandwidth, 44.1 kHz is enough for storing and transmitting audio. The problem is that the analog antialiasing filter before ADC must be extremely sharp to pass 20 kHz enough and block 22.05 kHz enough and this is just needs many components with good performance and tolerance. When sampling at higher rate like 192 kHz the analog filter can be simpler and cheaper as it has much wider transition band, it needs to pass 20 kHz and block at 96 kHz. The rate conversion and lowpass filtering can be made digitally to have sharp cutoff without aliasing. Same thing when playing audio back, upsample and reconstruct digitally the signal to 192 kHz for playback and the DAC output analog filter can be cheap and simple. The reconstruction filter just needs to be good enough that there is not much aliased spectral image after the 20kHz audio bandwidth and the analog filter removes the actual spectral images of the DAC rate. Therefore it makes sense to use higher rates at ADC and DAC, and maybe mastering of audio, but transmitting and storing frequencies that only dogs and bats can hear just costs more, not to mention equipment (amp, speakers) that are capable of producing them without issues. So basically eagh digital sample is just an infinitely narrow impulse and impulses repeated at sampling rate creates the spectral images that must be filtered out by a reconstruction filter that simply leaves the intended baseband signal intact.

$\endgroup$
  • $\begingroup$ "Same thing when playing audio back, upsample and reconstruct digitally the signal to 192 kHz for playback": It is here that I struggle to understand. Say $y[4n]$ is your upsampled output at 192kHz and $x[n]$ is your 48kHz input. For computing $y[j]$ exactly, don't you need to know all $x[i], i=0,n$? If yes, how do you upsample in real-time, when you don't know input samples past $j/4$? $\endgroup$ – user1202136 Jul 29 at 12:58
  • 1
    $\begingroup$ Well realizable digital filters can't see into the future, so they are causal and work only with present and past samples. Therefore a symmetrical FIR filter with N taps has a delay of N/2 taps. And the filter has some sane amount of taps, only enough to have enough filtering within the specified tolerance. Or it could be an IIR filter. Or biquad. Or multiple cascaded filters. Or no filter at all, just add zeroes between actual samples and let the analog filter do the job. $\endgroup$ – Justme Jul 29 at 14:14
2
$\begingroup$

Considering basic audio applications, the digital to analog conversion reconstruction filter (aka interpolation filter) is a low pass analog filter that removes all the image spectrum at the output before it goes to loudspeakers and retains only the baseband spectrum that resides in the filter's passband: inside its cutoff frequency of the lowpass filter. Note that the loudspeaker itself is also a strong part of the reconstruction lowpass filter characteristics, and ideal filters can be sufficiently relaxed under suitable conditions.

This passband (or cutoff frequency) of the interpolation filter ideally should be selected in accordance with the input sampling rate of the digital signal. If the original signal was adequately sampled at 44.1 kHz without aliasing, then under normal conditions (assuming no sample-rate conversion within the system), the output DAC sampling frequency and the associated interpolation filter cutofff frequencies should be selected as 44.1 kHz and 22.05 kHz respectively.

If the input was sampled at 96 kHz, then the output reconstruction DAC frequency should be 96 kHz and the reconstruction filter should have a cutoff frequency of 48 kHz, etc... Note that the theory uses ideal impulses and ideal filters to describe things (as I did above) but practical DAC circuitry uses zero order hold at the output and practical filters.

Note that if there is a mismatch between the input and output sampling rates then the playback speed will not match the recording speed. Also if you choose a lower cutoff frequency than the necessary minimum which is the Nyquist frequency of the output DAC sampling rate, then you will be throwing out the signal spectrum. Also if you choose the interpolation filter cutoff frequency larger than the Nyquist frequency then you will have image distortion at the audio output.

just one of the religious wars on digital audio is about whether 96 kHz sampling rate at the input is really necessary or not. And the consensus(?) is that, it's not necessary, based on empirical testing conducted so many times. But auidophiles are free to choose their favorite sampling rates anyway.

$\endgroup$
  • $\begingroup$ "Note that the theory uses ideal impulses and ideal filters to describe things (as I did above) but practical DAC circuitry uses zero order hold at the output and practical filters." Zooming in on this sentence, doesn't that mean that using non-ideal filters in the DAC stage leads to imperfect reconstruction of the sampled analog input? Otherwise put, does using a non-ideal filter "raise" the Nyquist rate? (I'm totally buying the empirical arguments of the anti-192 camp, but I have the feeling that there is a gap in the theoretical argument around the Nyquist-Shannon theorem with non-ideal fil $\endgroup$ – user1202136 Jul 29 at 13:08
  • 1
    $\begingroup$ The theoretical answer is as stated above. Coming to the practical argument; it's true that to ease the design of (sharp cutoff) analog filters, oversampling the input (and the output thereof) can be utilised. And yes, such a system is expected to produce less distorted audio. But there's nothing psychoacoustic here. Just filter design. The argument about whether the content above 20 kHz is adding any value to the audio (hearable or relevant ) is to my knowledge no. So you would benefit from ease of filter design, may get, slightly, less distorted output. And that's good. $\endgroup$ – Fat32 Jul 29 at 14:24
  • 2
    $\begingroup$ It may come as surprise but if the DAC has a Zero Order Hold, the output spectra is not flat but already distorted by sinc envelope. It is called the aperture effect. It attenuates high frequencies. It can be compensated away to some extent with an analog reconstruction filter that boosts high frequencies. Again another reason to upsample 48kHz to 192kHz at the DAC so that audio bandwidth of 20kHz is further away from DAC output sampling rate. Any filter, analog or digital, does not need to be ideal and perfect, just good enough that you can't hear non-idealites (or measure them). $\endgroup$ – Justme Jul 29 at 14:30
  • $\begingroup$ @Justme yes the inverted sinc magnitude response is suggested to correct the spectral distortion... Higher sampling rates would make it easier to realize, at the cost of more processing power and storage (or up/down conversion which itself could produce more distortion than the nonideal reconstruction filter would do! ;-) ) $\endgroup$ – Fat32 Jul 29 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.