• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required as is 20 years of participation in forums (not all true). There are daily reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Why is Windows sample rate still not dynamic ?

Jose Hidalgo

Addicted to Fun and Learning
Joined
Aug 15, 2020
Messages
887
Likes
848
Location
France
Hi guys, I've been wondering this for a while now, but I've never found a clear answer.

It's one thing to set Windows bitrate to the maximum possible : in my case 32-bit since my DACs are 32-bit, so it allows for playing 16-bit or 24-bit music, with even some headroom for digital volume control. Great ! :D

But sadly, sample rate is another story. :confused: So for all of us who have audio files @44.1 / 48 / 88.2 / 96 / 176.4 / 192 KHz and so on, we have to juggle with Windows sound panel and adjust it on the fly before playing a given file (which quickly becomes unmanageable), OR just set it to a fixed sample rate and leave it.

So my first question would be : how come that in 2021 nobody has yet found a way to dynamically adjust Windows sample rate to the played audio ? Basically it's telling Windows "don't touch the signal : if it's 16-bit treate it as 16-bit, and if it's 32-bit treate it as 32-bit". Why is that so difficult ? :oops:

My second question would be : since it seems that we can't do that (adjusting sample rates dynamically), what would be the "arguably best" sample rate in a SCIENTIFIC, measurable way ? (I don't care about listening impressions, only measurements count). Should we even care about it ?

Me, for example, 98% of my files are 16-bit/44.1 KHz (like most of you I guess). So I guess I should just set everything to 32bit/44.1 KHz and be done with it, right ? But then what's the point in even having higher sample rate files ?... :p

I hope your answers will finally ease my mind. Thanks in advance !

PS : the questions are both valid for Win 7 and Win 10, since I have both. :)
 

DVDdoug

Addicted to Fun and Learning
Joined
May 27, 2021
Messages
848
Likes
1,013
From what I understand, ASIO drivers won't resample, but your application has to support ASIO and your hardware needs ASIO drivers*. (ASIO is widely used in pro audio but not so common in home audio.) Apparently WASAPI exclusive mode can also do that, but I don't know what's involved in configuring it and I don't know if you have to re-configure it every time you change the sample rate.

So my first question would be : how come that in 2021 nobody has yet found a way to dynamically adjust Windows sample rate to the played audio ?
The reason is simple... So you can use any-old Windows application to play a 32-bit, 196kHz file on any-old cheap soundcard, etc. Everything "just works" with everything. Windows does the same thing to display a high-resolution image on a lower resolution monitor, etc.

Basically it's telling Windows "don't touch the signal : if it's 16-bit treate it as 16-bit, and if it's 32-bit treate it as 32-bit". Why is that so difficult ?
I could be wrong, but I think DACs & ADCs always work at a fixed bit-depth and the drivers take care of any conversion. And, I'm pretty sure ASIO will adjust the bit-depth, just not the sample rate.

I've also read "rumors" that some regular soundcards/soundchips only work internally at a fixed 44.1 or 48kHz sample rate.


* There is a universal driver called ASIO that replaces part of Windows driver stack, allowing you to use non-ASIO hardware with an ASIO application. (It doesn't work the other way around.) But, I'm not sure if it also avoids resampling.
 
OP
Jose Hidalgo

Jose Hidalgo

Addicted to Fun and Learning
Joined
Aug 15, 2020
Messages
887
Likes
848
Location
France
Yes, I know about ASIO, WASAPI and KS. But I'm not using any of them anymore because I'm using Equalizer APO now.
Well, I could use ASIO with EAPO, but DDF proved that it was unnecessary.

Anyway, once the signal is treated by EAPO, it still has a given bitrate and a given samplerate. So I still wonder : why can't Windows recognize such samplerate and bitrate and just output it ? That really beats me. If any experts out there have an explanation...
 

Blumlein 88

Grand Contributor
Forum Donor
Joined
Feb 23, 2016
Messages
14,256
Likes
22,846
Yes, I know about ASIO, WASAPI and KS. But I'm not using any of them anymore because I'm using Equalizer APO now.
Well, I could use ASIO with EAPO, but DDF proved that it was unnecessary.

Anyway, once the signal is treated by EAPO, it still has a given bitrate and a given samplerate. So I still wonder : why can't Windows recognize such samplerate and bitrate and just output it ? That really beats me. If any experts out there have an explanation...
Because if Windows handled sound nicely it would be one less reason to use a Mac. Your best bet is to use gear that can do ASIO. Macs show it is possible and why Windows doesn't I don't know.
 

edechamps

Addicted to Fun and Learning
Forum Donor
Joined
Nov 21, 2018
Messages
771
Likes
3,072
Location
London, United Kingdom
If you want bit-perfect operation, use WASAPI Exclusive, ASIO, or WDM/KS.

As for why Windows doesn't switch audio formats automatically: I can't speak for the Windows audio engine developers, but I can hazard a guess. It may be to avoid resetting the audio device every time there's a change in mix format. With some audio hardware, such resets could end up producing audible "pops" (discontinuities) every time the output mix format changes.

It may also be that using a static format was the simplest option for the developers, and that a dynamic format would introduce complexity that wouldn't be worth it given that resampling is pretty much inaudible.
 

Frgirard

Major Contributor
Joined
Apr 2, 2021
Messages
1,421
Likes
822
All sound card dither 16 to 24 or 32 bit.

Wasapi doesn't change the sample rate automatically also.
I use asio and downsample all in 44,1 kHz.
Because
1. Shannon and Nyquist and i'm not an avangers.
2. i use plogue of Bidule, a vst host with a manually sample rate change.
 

Berwhale

Major Contributor
Forum Donor
Joined
Aug 29, 2019
Messages
2,361
Likes
2,812
Location
UK
So my first question would be : how come that in 2021 nobody has yet found a way to dynamically adjust Windows sample rate to the played audio ?

What sample rate would you suggest that Windows should choose if two pieces of audio are playing at the same time and those two pieces of audio have different sample rates?
 

voodooless

Major Contributor
Forum Donor
Joined
Jun 16, 2020
Messages
3,886
Likes
6,059
Location
Netherlands
It’s really simple: the os is build to run multiple applications that can all play audio at various sample- and bitrates. To facilitate this one output setting is chosen and all playback sources are resampled to that rate.

If you don’t want that, use some way to get exclusive access to the audio hardware.

So what @Berwhale said ;)
 
Last edited:

Offler

Active Member
Joined
May 27, 2021
Messages
286
Likes
240
Wasapi doesn't change the sample rate automatically also.
.
Applications tend to change sample rate in WASAPI Exclusive mode to bit-perfect output, but it happens only for certain media players (Media Player Classic Home cinema)
 

Frgirard

Major Contributor
Joined
Apr 2, 2021
Messages
1,421
Likes
822
What sample rate would you suggest that Windows should choose if two pieces of audio are playing at the same time and those two pieces of audio have different sample rates?
It's a convoluted answer.

Many software doesn't change the sample rate. Wasapi does not change the sample rate.
 

Frgirard

Major Contributor
Joined
Apr 2, 2021
Messages
1,421
Likes
822
Applications tend to change sample rate in WASAPI Exclusive mode to bit-perfect output, but it happens only for certain media players (Media Player Classic Home cinema)
Not in foobar.
 

Promit

Active Member
Joined
Apr 1, 2020
Messages
188
Likes
499
What sample rate would you suggest that Windows should choose if two pieces of audio are playing at the same time and those two pieces of audio have different sample rates?
Exactly this. The Windows setting is the output of a digital mixer, and that mixer can have any number of incoming sources at whatever the hell bit depth and sampling rate.

The short answer is, set the rate to the highest values your DAC or audio interface supports. That will provide the best overall experience, driver issues notwithstanding. If you really must have bit-perfect output, get a player that supports exclusive mode and will change the output settings globally.
 

danadam

Addicted to Fun and Learning
Joined
Jan 20, 2017
Messages
582
Likes
826
What sample rate would you suggest that Windows should choose if two pieces of audio are playing at the same time and those two pieces of audio have different sample rates?
The sample rate of the file that started playing first. At least that's what pulseaudio with "avoid-resampling" option is doing on Linux.
 

Offler

Active Member
Joined
May 27, 2021
Messages
286
Likes
240
So my first question would be : how come that in 2021 nobody has yet found a way to dynamically adjust Windows sample rate to the played audio ? Basically it's telling Windows "don't touch the signal : if it's 16-bit treate it as 16-bit, and if it's 32-bit treate it as 32-bit". Why is that so difficult ? :oops:

My second question would be : since it seems that we can't do that (adjusting sample rates dynamically), what would be the "arguably best" sample rate in a SCIENTIFIC, measurable way ? (I don't care about listening impressions, only measurements count). Should we even care about it ?

Me, for example, 98% of my files are 16-bit/44.1 KHz (like most of you I guess). So I guess I should just set everything to 32bit/44.1 KHz and be done with it, right ? But then what's the point in even having higher sample rate files ?...:p

1. Windows allows multiple sound sources to get mixed and overlap
This is an approach since Windows 98SE WDM drivers and its sort of "multitasking" on audio level. As it happens 98% of PC audio content is indeed 44.1KHz 16bit which was back in later 90s accepted as standard not only for CDs.

Part of it is a mixer (which should now work on 32bit float) which combines all the sound channels and then outputs them to the sound card. For a long time 44KHz or 48KHz 16bit were the only two options, now even with more options there is lack of content.

2. What would be best sample rate (for Shared Mode)
Option a) Bit Perfect Output
Just select 44.1KHz at 16bit and dont think about it. Its native for most of the content (games, CDs, streams).

Option b) 44.1KHz at 24bit or higher
Since the sound gets mixed higher bit rate may reduce dithering artifacts. I considered it to be a snake oil, then i did measurements myself.

I sent 1KHz sinewave and captured it using 44.1KHz at 16 and 24bit through software oscilloscope, and then I started to decrease volume.

Sinewave at 24bit was still keeping most of its shape, where 16bit sinewave completely turned into noise.
https://www.stereophile.com/content/nad-d-3020-integrated-amplifier-measurements
Figure 16.

Supposedly this measurement should mean lower distortion.

For my specific configuration its 44.1KHz at 24bit as its maximum output for the both DAC and Optical SPDIF

Resampling from 44.1 to 48 and vice versa is causing distortion so try to avoid it.
Using sample rates multiplied by 2 (88.2 or 96Khz) does not seem to have any positive measurable effect.

3. For playing media I recommend WASAPI Exclusive mode.
This mode sends data direclty to the DAC without any interference from OS.

MediaPlayer Classic Home Cinema switch to 48KHz 24bit instantly for BluRays with DTS-HD MA audio. PowerDVD supports exclusive mode in similar manner while system mixer is bypassed.

Foobar requires a plugin which unfortunately does not read input stream, and has to be configured manually.
 

Berwhale

Major Contributor
Forum Donor
Joined
Aug 29, 2019
Messages
2,361
Likes
2,812
Location
UK
The sample rate of the file that started playing first. At least that's what pulseaudio with "avoid-resampling" option is doing on Linux.

So the "avoid re-sampling" setting forces all subsequent peices of audio to be re-sampled? It sounds like this setting has the potential to cause more re-sampling than it prevents.
 

danadam

Addicted to Fun and Learning
Joined
Jan 20, 2017
Messages
582
Likes
826
So the "avoid re-sampling" setting forces all subsequent peices of audio to be re-sampled? It sounds like this setting has the potential to cause more re-sampling than it prevents.
If you start the next piece before the previous one stops, then yes. But in practice that doesn't happen often.
 

Berwhale

Major Contributor
Forum Donor
Joined
Aug 29, 2019
Messages
2,361
Likes
2,812
Location
UK
If you start the next piece before the previous one stops, then yes. But in practice that doesn't happen often.

My PC makes many sounds - systems sounds, web pages, messaging and VoIP calls, etc. These sounds play over music many times per day.
 

tmtomh

Major Contributor
Joined
Aug 14, 2018
Messages
1,375
Likes
4,040
I use Macs and greatly prefer MacOS to Windows - but MacOS doesn't support on-the-fly sample-rate switching either.

For me the problem isn't upsampling per se - I couldn't care less if my OS turns my 44.1k source material into 88.2k or any other multiple of 44.1k before sending it out to an external DAC - it's just duplicating samples, who cares?

The problem, rather, is the 44.1k vs 48k (and multiples thereof) difference, with redbook being the former and most high-res files being the latter.

However, @danadam has taught me that you can downsample a 96k source to 44.1k and then resample it back to 96k, and the result will be 100% bit-perfect to the original for frequencies below 22.05kHz. So I shouldn't care at all about the lack of resolution-switching in the OS - I should just set the output to the sample rate of whatever the highest sample-rate file in my music library is and forget about it.

But for some reason I still mentally/emotionally prefer to have the output be at the proper sample rate. So in my case I use the BitPerfect app, which sits between iTunes/Apple Music app and the Mac's audio subsystem and automatically does on-the-fly resolution switching (and of course ensures otherwise bit-perfect output as well). It's only $10 in the App Store, and I like the iTunes/Music app interface, so it's a super-cheap and good solution for me.
 
Top Bottom