Tuesday 5 November 2013

To upsample or not to upsample; that is the question.

Back in late March, I posted some introductory comments here regarding how DACs actually function.  Anyway, following my recent posts on Sample Rate I thought it might be apropos to revisit that subject.

Today’s DACs, with a few very rare (and expensive) exceptions, all use a process called Sigma Delta Modulation (SDM, sometimes also written DSM) to generate their output signal.  A nice way to look at SDM DACs is to visualize them as upsampling their output to a massively high frequency - sometimes 64, 128 or 256 times 44.1kHz, but often higher than that - and taking advantage of the ability to use a very benign analog filter at the output.  That is a gross over-simplification, but for the purposes of the point I am trying to make today, it is good enough.

Doing such high-order up-conversion utilizes a great deal of processing power, and providing that processing power adds cost.  Additionally, the manufacturers of the most commonly used DAC chipsets are very coy about their internal architectures, and don’t disclose the most significant details behind their approaches.  I would go so far as to say that some DAC manufacturers actually misunderstand how the DAC chipsets which they buy actually work, and publish misleading information (I have to assume this is not done intentionally) about how their product functions.  Much of this centres around cavalier usage of the terms ‘upsampling’ and ‘oversampling’.  Finally, some DAC manufacturers use DAC chipsets with prodigious on-chip DSP capability (such as the mighty ESS Sabre 9018), and then fail to make full use of it in their implementations.

Let’s study a hypothetical example.  We’ll take a 44.1kHz audio stream that our DAC chip needs to upsample by a factor of 64 to 2.88MHz, before passing it through its SDM.  The best way to do this would be using a no-holds-barred high-performance sample rate converter.  However, there are some quite simple alternatives, the simplest of which would be to just repeat each of the original 44.1kHz samples 64 times until the next sample comes along.  What this does is to encode the “stairstep” representation of digital audio we often have in mind, in fine detail.  This is acceptable, because, in truth, the 44.1kHz audio steam does not contain one jot of additional information.  Personally, I would refer to this as oversampling rather than upsampling, but you cannot rely on DAC manufacturers doing likewise.

If we are going to use this approach, though, it leads us down a certain path.  It results in the accurate recreation of the stairstep waveform at the output of the DAC.  Even though we have oversampled by a factor of 64 in our SDM process, the output of our DAC has been a faithful reproduction of a 44.1kHz sampled waveform.  This waveform, therefore needs to go through an analog brick-wall filter to strip out the aliases which are embedded within the stairstep.  This is exactly as we discussed in my last post on Sample Rates.

In principle, therefore, by upsampling (using proper Sample Rate Conversion) our 44.1kHz audio by a factor of 2 or 4 prior to sending it to the DAC, we can avail ourselves of the possibility that the DAC can instead implement a less aggressive, and better-sounding, brick-wall filter at its output.  That would be nice.  But that is not the way many (and maybe even most) DACs that use this approach are built.  Instead, they use the same analog brick-wall filter at high sample rates as they do at 44.1kHz (because switching analog filters in and out makes for complicated - read expensive - circuitry).  If your DAC does this you would not expect to hear anything at all in the way of sonic improvement by asking BitPerfect (or whatever other audio software you use) to upsample for you.

So let’s go back a couple of paragraphs, and instead of our DAC oversampling the incoming 44.1kHz waveform, suppose it actually upsamples it using a high quality SRC algorithm.  Bear in mind that all of the audio content up to 20kHz in a 44.1kHz audio stream is aliased within the frequency band from 24.1kHz to 44.1kHz.  If we are to upsample this, we should really strip the aliases out using a digital brick-wall filter.  Done this way, the result is a clean signal that we can pass into the SDM, and which is precisely regenerated, without the stairstep, at the DAC’s output.  So we no longer need that aggressive, sonically worrisome, analog brick-wall filter.

Let’s take another look at these last two scenarios.  One had an aggressive analog brick-wall filter at the output, but the other had essentially the same brick-wall filter implemented digitally at an intermediate processing stage.  If the two sound at all different, it can only be because the two filters sounded different.  Is this possible?  In fact, yes it is, and there are two reasons for that.  The first, as I mentioned in a previous post, is that an analog filter has sonic characteristics which derive from both its design, and from the sonic characteristics of the components with which it is constructed.  The digital equivalent - IF (a big IF) properly implemented - only has sonic consequences arising from its design.  There is a further point, which is that digital filters can be designed to have certain characteristics which their analog counterparts cannot, but that fact serves only as a distraction here.  The bottom line here is that, if properly designed, a diligent DAC designer ought to be able to achieve better sound with this ‘upsampling’ approach than with the previously discussed ‘oversampling’ approach (again, I must emphasize this is MY usage of those terminologies, and is not necessarily everybody else’s).

Using the ‘upsampling’ approach I have just described, it should once again make little difference whether you send your music to the DAC at its native sample rate, or if you upsample it first using BitPerfect (or whatever).  However, all this assumes that the upsampling algorithm used by the DAC is at least as good as the one used by BitPerfect.  There is no guarantee that this will be so, in which case you may find that you get improved results by using BitPerfect to upsample for you to the maximum supported by your DAC.  And you should use one of the SoX upsampling algorithms provided by BitPerfect, rather than CoreAudio.

The bottom line here is that you should expect your DAC to sound better (or at least as good) with your music sent to it at its native sample rate than with it upsampled by BitPerfect.  And if it doesn’t, the difference is probably down to BitPerfect’s upsampling algorithm sounding better than the one implemented in your DAC’s DSP firmware.

So, in summary, in light of all the above, our recommendation here at BitPerfect is that you do NOT use BitPerfect to upsample for you, unless you have conducted some extensive listening tests and determined that upsampling sounds better in your system.  These tests should include serious auditioning of BitPerfect’s three SoX algorithms.