Sample Rate Conversion

All operating systems can do sample rate conversion.
The reason is obvious.
A sound card can play only at one rate at the time (the rate of the clock driving the DAC).
If you have multiple streams e.g. playing audio and a system beep, both must have the same sample rate to be playable at the same time.

Another reason to re-sample is that the source has a sample rate not supported by the hardware; e.g. you downloaded 24 bit/ 192 kHz audio and your sound card supports 16 bits/ 48 kHz max.

Sound quality

Sample rate conversion shouldn't’t affect sound quality.
Writing a good SRC is not trivial.
In practice it can generate audible artifacts.


Famous is the XP K-mixer. You can find tons of complains about it on the internet.

 

Benchmark Media provides an example of the impact of sample rate conversion in OSX 10.4.6

 

A 16-bit 10k sine wave played through iTunes on OSX 10.4.6, without any sample-rate conversion.

 

A 16-bit 10k sine wave played through iTunes on OSX 10.4.6,

with sample-rate conversion from 48 kHz to 44.1 kHz.

 

The distortion seen in this graph is solely caused by sample-rate converting from 48 kHz to 44.1 kHz. As seen in the graph, the signal-to-noise ratio went from 130 dB to less then 80 dB!

Apples own K-mixer.

 

This information is from 2006, today Apple does a much better job.

 

Apple Mac OS X ("Yosemite") Software Audio Upsampling - Archimago's Musings .

 

 

dCS measured the up sampling in Vista from 44 to 96.

The dark line is the original 16/44.1 signal.

Obvious Vista SRC generates artifacts.

I must admit I do think the artifacts ways to high.
So high, I wonder if dCs has measured it correctly.

 

More recently, Archimago measured the Win 10 sample rate conversion

It will do sample rate conversion requiring few resources but it measures poorly.

 

MEASUREMENTS: Windows 10 "Audio Stack" / DirectSound Upsampling - Archimago's Musings

Solutions

Both Win7 and OSX have a preference panel where you can set the sample rate.
If the source differs from this rate, it will be re-sampled.

Testing

A first an obvious one it to fool around a little with the SRC of your operating system.
Play Redbook audio (44.1 kHz) and try a couple of settings like 48, 88 and 96 (if your hard ware supports this).
Download a hi-res track e.g. 24/96 or 24/176 and try various down sampling rates.

If you don’t hear a difference, stop bothering.

Fixed

If your collection is 44.1 only (CD, MP3) you might simply set the OS to 44.1 kHz.

Bypassing the OS

All operating systems expect you to use DSP (like volume control) and play multiple streams.
Hence all audio is converted to float and fed into a mixer.

As our DACs most of the time only understands 16 or 24 bit integers, the audio is dithered and converted to 24 (or 16 if you have an old DAC).

 

You can avoid this by bypassing the OS audio.
If your hardware supports ASIO, you can use this driver.
Windows also offers WASAPI.
On a Mac look for media player offering integer mode.

If you bypass the OS audio, you get automatic sample rate switching as well.

Of course this only works as long as the hardware supports the formats you provide.

Playing all your audio at its native sample rate is probably the best solution.

Software or hardware

A lot of DACs do up-sampling. Often everything is up-sampled to e.g. 24/192.
This is done by a DSP-chip, a microprocessor.
Compared with a PC they are down in power and precision. A PC can do everything in 64 bit float or even 128. DSP chips in general are down on precision.
An option is to let the PC do the SRC; you defeat the SRC of the DSP chip.
Of course the results are completely system dependent.

 

No sample rate converter is perfect, there are tradeoffs involved. Some come from limitations of the compute power and/or knowledge of DSP design and programming, but others are inescapable and come from mathematics. This is particularly problematical at the lower sampling rates. In addition, although theory says that conversion from mixed rates such as 88.2 to 96 ought to be no worse than even rates, this does not prove out in practice, possibly because the computation required is significantly more complex and therefore there are more ways to do things poorly.

When you upsample you do filtering in the computer, in effect replacing the DAC's filter with the computer's filter. In general these will be different and so the sound will be (somewhat) affected. Whether one way is better than another depends on the filters involved, i.e. there can be no general rule. Pragmatically, it is often the case that upsampling improves a cheap DAC, but it is less likely that upsampling will improve a great DAC and it may make things worse. Hence, YMMV.

Tony Lauck

 

A bit more technical detail.