Optimizing Windows Audio

A little bit of history

When XP was released in 2001, computer power was low compared with what we enjoy today.
All DSP (Digital Signal Processing like sample rate conversion, mixing, etc.) was done in integer. This is indeed very efficient so frugal om power but it lacks precision because each calculation results in a quantization error.
Complains about the k-mixer were numerous.
From Vista on Windows has a redesigned audio stack.
The DSP is done in 32 bits float.
This improved the DSP substantial.

Multiple audio streams

By default Windows audio runs in shared mode.
All applications can access the audio device at the same time.
You are watching a video, listening to the sound, but you don't want to miss the notification of a newly arrived email.
This is done by mixing the audio streams.
Mixing can only be done if all the audio streams run at the same sample rate (your DAC can't run 2 sample rates at the same time either).
Hence Windows runs at a fixed sample rate and bit depth.
This according to the values you set in the Audio Panel.

AudioPanel

Choosing the right sample rate and bit depth

As Windows run at a fixed sample rate and bit depth, the question is what is the optimal setting.
An obvious answer is to bypass the Win audio all together by using WASAPI Exclusive (see below).
But not all applications allow you to do so.
Most of them simply output to what is set as the default audio device in Win.
A simple solution is to match the sample rate of the most common format.
In general this is 16 bit / 44.1 kHz PCM audio. Indeed the format used on the CD has become the standard.
Sounds plausible to use this as the default setting in de audio panel.
As far as the sample rate is concerned, I agree.
In case of bit depth, 16 bit is the wrong setting.

 

16 bits PCM audio allow for a dynamic range of 96 dB and 24 bits allow for 144 dB.
To phrase it slightly different, the loudest a DAC can play at the digital side is defined as 0 dBFS.
It cannot play louder as there is no bigger integer.
A 16 bit recording can go down to -96 dBFS, a 24 to -144 dBFS.
A 24 can resolve the tiny details below -96 dBFS.


In practice, a recoding probably have 20 maybe 21 bits max filled with musical information, the rest is random noise. Likewise the noise floor of your gear on playback will mask all those tiny details.

Anyway, this are the limits of 16 and 24 bit PCM audio.
What you set in the Audio Panel is the data path to your DAC.
Basically it is the arithmetic precision so you better max out.


Play 16 bit audio, apply 48 dB attenuation and set the OS to 16 bit.
1111111111111111
0000000011111111
Obvious you will lose 8 bits of resolution as you force the OS to truncate to 16 bit.

 

If you do the same, this time with the OS set to 24 bit
111111111111111100000000
000000001111111111111111
You will have 48 dB attenuation and still have full resolution.


This is of course a bit theoretical as no playback chain can resolve signal at -144 dBFS but you do improve on arithmetic precision.
Likewise dither.
If DSP is done, dither must be applied when using 16 bits.
In case of 24 it is probably superfluous as dither is decorrelating the LSB and at -144 this is not audible.


There is also a practical reason not to use 16.
Even a stone age protocol like SPDIF uses 24 bit for the audio. No reason to truncate to 16 and have it padded with 8 zero bytes to fit into the 24 bit audio part of this protocol.

 

Always set the bit depth to the max supported by your audio device.

Single audio stream

Hearing multiple audio streams can be convenient but having a email notification at full blast over the stereo isn't.
As the onboard audio is often a bit poor, a seperate DAC to drive your stereo is a good solution.
Set the onboard speakers to be the default audio device and mute them.
Inside your media player choose your DAC as the output device.

Bit perfect

Bit perfect is sending the audio file unaltered to the audio device.

It is often advocated as the only right way to improve sound quality.
This of course cannot be the case.
If you deliver an audio file unaltered, its quality will remain the same so no improvement at all.

 

Most of the time bit perfect playback refers to the absence of any type of DSP (Digital Signal Processing) like volume control, sample rate conversion, dither, etc.
This exclude tools like EQ or DRC.
EQ (Equalizing) is very popular in the headphone world.
The frequency response of headphone is often pretty ragged.
Likewise the tuning might not be your stye (often pretty bass heavy).
Applying EQ can improve the sound quality.
Likewise DRC (Digital room correction) has become popular. You compensate for room modes by creating a target response.


Be it EQ or DRC, you are as bit imperfect as you can be to get better sound quality.
If you think bit perfect is the holy grail of computer based audio, you sacrifice all these options.


A better and more useful approach is to avoid unnecessary processing that might result in a possible degradation of the sound quality.


This is done by bypassing the audio part of the operating system.
In case of Windows, this is done by using WASAPI in Exclusive mode.
This bypasses the entire Windows Audio.

Note your media player must allow you to choose this driver to do so.


The device will take an exclusive lock on the audio device.
Now that one and only one app is using it, this allows for automatic sample rate switching.
Likewise no email notifications at full blast over the stereo while playing a string quartet.
No dither either.
The windows mixer is always active.
Regardless of the number of audio streams, every stream is converted to float and back to integer and dithered.
Now that you bypassed the mixer, this is no longer the case.


If you configure your media player to use WASAPI/Exclusive, are you bit perfect?
The answer is "it depends".
Obvious, bypassing the Win Audio avoids any possible degradation or modification.
The output of the media player is delivered unaltered to the audio endpoint.
However inside the media player you can apply all the DSP you think useful like volume control, EQ, crossfeed, etc. If you do you alter the audio and are no longer bit perfect in the purist sense but you do get a better sound.

Sample rate conversion

As mentioned in the introduction, the XP k-mixer was famous for its poor quality.
Unfortunately, there is still a problem.

Archimago measured the Win 10 sample rate conversion

It will do so requiring few resources.
That’s nice as even on a low powered computer it will work but unfortunately it measures poorly.

 

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

 

After the dreaded K-mixer in XP, Microsoft did it again!
Another crappy re-sampler.

However, it turned out to happen only with signals to full scale.
Using just a slight attenuation before the signal is send to the Win audio stack will solve this problem.
See Windows Sample Rate Conversion for solutions.