Sample Rate Conversion

Like all operating systems, Windows is build with multiple audio streams in mind.
You are watching a video and hear a notification sound when a e-mail comes in.
This can only be done it the audio of both streams are mixed.
You can only mix audio digital if both have the same sample rate.

 

All audio is send to the audio engine where it is resampled (if needed), converted to 32 bit float, mixed, dithered and converted back to integer.
This according to the settings in the audio panel.

Dither

If one converts from float back to integer (DAC’s want them) there will always be a round off error (quantization error). As this error is correlated to the audio, dither is the trick to de-correlate it by adding some noise. In case of a 16 bit DAC it is needed as artifacts at -96 dBFS are audible.
Today our DAC’s are 24 or even 32 bit. One might wonder if dither at -144 dBFS is needed.
It is way below the noise floor of our gear.
Likewise a good quality Hi-Res recording probably contains musical info up to 20/21 bits, the rest is random noise.
This makes the conversion from float to integer by the mixer a moot point.

Resampling

Using shared mode, any audio stream that differs from the rate as set in the audio panel, has to be resampled.


Archimago measured the Win 10 sample rate conversion.

It requires few resources but it measures poorly.

It looks like they took some shortcuts for the sake of computational elegance at the  expense of sound quality.

Windows 10 "Audio Stack" / DirectSound Upsampling - Archimago's Musings (2015)

 

For a long time we thought the resampler to be the culprit.

Bennetng pointed out that this only happens when using full scale signals.
Anytime a signal comes close to 100%, CAudioLimiter APO kicks in and produces these artifacts.

 

Limiter

Linearity of Windows volume APIs – IAudioMeterInformation and full-scale signals - Matthew van Eerde's web log.

 

You might wonder if this is really a big problem.
Most recordings do have sufficient headroom.
Only the typical exponents of the loudness war ( strong dynamic compression and level up to 0 dBFS) might distort when resampled.

Solutions

WASAPI

A very simple one is not to use the Win audio engine.
This can be done by using WASAPI in Exclusive mode.
The output of the media player is send straight to the audio driver bypassing the mixer completely.
This is the trick to get automatic sample rate conversion.
However the properties of the stream (number of channels, bit depth and sample rate) have to match the capabilities of the audio device exactly.
If not, it is silence.
Obvious as the Win audio engine is bypassed, the bit depth/sample rate as set in the audio panel is irrelevant.
ASIO can be used as well but your audio device must support this protocol.

 

However, you can only do this if the media player allows you to choose a driver.
A lot of applications don’t offer this, they simply use the Windows Audio Stack and this shared mode by design.

Manual matching

Set the sample rate in the Audio Panel to what is common (44.1 kHz, CD quality).

If start playing hires, match the sample rate manual.
Bit of a burden.
Streaming audio services often offer a mix of 44.1 kHz - 192 kHz.

Pre-amp

The only thing you have to do is lowering the output of your media player.

Reducing the output to 98% should be sufficient to avoid the CAudioLimiter APO to kick in.

This requires the media player to have its own volume control.

Being bit imperfect improves the sound!

Equalizer APO

It works system wide (shared mode).

You can use it to EQ your headphone system wide so you have exactly the same EQ regardless the applications.

You can use it to bypass original APO’s (Audio Processing Objects) but perhaps most important, it has a pre-amp function.
Lower the volume with -4 dB and you avoid the CAudioLimiter kicking in.

DDF has more

 

References
  1. Windows 10 "Audio Stack" / DirectSound Upsampling - Archimago's Musings (2015)
  2. Windows resampling not actually that bad? - Audio Science Review
  3. Linearity of Windows volume APIs – IAudioMeterInformation and full-scale signals - Matthew van Eerde's web log
  4. Ending the Windows Audio Quality Debate - Audio Science Review (2021)