Windows 7's resampling sucks

2011-02-09 19:30:23

Playback over WASAPI must match the sample rate of the output device. Thus applications must supply their own resampling if the playback rate does not match. Most applications don't do this but just employ MME or DirectSound, which provide transparent resampling for non-matching rates.

Since some of my content is 44.1 kHz and some 48 kHz I used to set the output rate to 192 kHz so that all audio had to be upsampled. With good software resampling and a cheap onboard codec this could, in theory, even improve the overall result. But the opposite was true. Today I couldn't longer ignore the impression that the resampled output sounded somewhat muffled and did some measurements.

You can view the result [a href='index.php?showtopic=86675']here[/a]. The upsampled output (44.1 -> 192 kHz) suffers from quite a HF roll-off in comparison to pure 44.1 kHz output.

In Windows XP the SRC quality could be adjusted. I can't find anything comparable in Windows 7. Does anyone know more?

Windows 7's resampling sucks

A) WASAPI doesn't force any player to resample. One has to resample only if it uses exclusive mode, and if it uses exclusive mode it's for a reason, not for the operating system to do the work for you.

B) The frequency that is set in the device configuration is precisely the samplerate at which it operates the final mix (if not in exclusive mode), and as such, the sampling rate at which other sources get resampled.

C) I have no idea what you've supposedly done, but let me be doubtful that simply upsampling causes the effect you show (which isn't as big as you try to suggest. It's 7dB! )

D) Please, consider using adequate words in this forum. "This sucks" or "This 0wns" are not adequate words.

Windows 7's resampling sucks

[quote author=[JAZ] link=msg=743017 date=1297280504]A) WASAPI doesn't force any player to resample. One has to resample only if it uses exclusive mode, and if it uses exclusive mode it's for a reason, not for the operating system to do the work for you.[/quote]

Please don't try to educate me when you're missing the facts. You couldn't have misrepresented them any worse. Shared mode WASAPI doesn't provide SRC, applications have to provide it themselves. A quick Google search delivers this, for example, a blog post by one of the developers of WASAPI, Larry Osterman. MSDN has more information, but you can search yourself. You also misunderstand exclusive mode. It does neither provide SRC, but it also isn't needed since in exclusive mode the application can directly set the endpoint device's sample rate.

[quote author=[JAZ] link=msg=743017 date=1297280504]B) The frequency that is set in the device configuration is precisely the samplerate at which it operates the final mix (if not in exclusive mode), and as such, the sampling rate at which other sources get resampled.[/quote]

I haven't written anything to the contrary. I was just more precise, transparent resampling only happens via DirectSound and MME.

[quote author=[JAZ] link=msg=743017 date=1297280504]C) I have no idea what you've supposedly done, but let me be doubtful that simply upsampling causes the effect you show[/quote]

RMAA output was captured two times by a Macbook Pro with a sample rate of 96 kHz. One time the output rate on the Windows 7 computer was set to 192 kHz, the second time to 44.1 kHz. The plot is from RMAA's 'analyze' function applied to the captured recording.

If 7dB, more than twice as loud, isn't much for you I can't help. I also read the plot differently. The difference is at most 2dB, where it matters, which admittedly isn't much. But at times when even free onboard codecs deliver exceptional performance, the OS shouldn't mess this up without a reason.

Windows 7's resampling sucks

Since some of my content is 44.1 kHz and some 48 kHz I used to set the output rate to 192 kHz so that all audio had to be upsampled. With good software resampling and a cheap onboard codec this could, in theory, even improve the overall result. But the opposite was true. Today I couldn't longer ignore the impression that the resampled output sounded somewhat muffled and did some measurements.

You can view the result [a href='index.php?showtopic=86675']here[/a]. The upsampled output (44.1 -> 192 kHz) suffers from quite a HF roll-off in comparison to pure 44.1 kHz output.

Were you able to ABX that? 1dB of rolloff at 17kHz seems like it would be difficult enough with test tones, let alone real music.

Windows 7's resampling sucks

It's hard to ABX the different paths directly against each other and I didn't do that. I had an impression and did the measurement because of it. A lot of experimental electronic (noise) music fills my playlists, which is quite sensitive w.r.t. missing HF headroom. But 1-2 dB indeed isn't much, I'll try a formal ABX later this week. I think it should be doable.

I could also post the RMAA test recordings. But they are over 50 MB each, uncompressed.

PS Windows 7 (and Vista) has a fantastic audio sub system in every respect: mixing, latency, comfort, performance, and developer APIs. IMHO even better than Apple's Core Audio. I was just somewhat pissed to find such a regression behind XP at this end: choose a cheap default and even remove the option to improve it. But maybe it's still there and someone else can point me to it.

PS to my last post: The sample rate of RMAA was set to 44.1 kHz both times.

Windows 7's resampling sucks

WASAPI in exclusive mode send the output straight to the audio driver.It is up to the programmer to match the driver with sample rate, bit depth and channels of the source or to match the source with the capabilities of the driver

In exclusive mode, the client can choose to open the stream in any audio format that the endpoint device supports. In shared mode, the client must open the stream in the mix format that is currently in use by the audio engine (or a format that is similar to the mix format). The audio engine's input streams and the output mix from the engine are all in this format.

Windows 7's resampling sucks

[quote author=[JAZ] link=msg=743017 date=1297280504]D) Please, consider using adequate words in this forum. "This sucks" or "This 0wns" are not adequate words.[/quote]This is not to be meant in any way harmful but since when did this forum become snotty? Besides, he didn´t attack a person, he "insulted" a resampling engine. Which is another matter IMO. IF he would have attacked a person, then I´d write the sentence you wrote, JAZ. Now you can write "Oh, but he attacked the programmer of this resampling engine." Well, in that case... people from Microsoft got used to it over the years, won´t you say?

Were you able to ABX that? 1dB of rolloff at 17kHz seems like it would be difficult enough with test tones, let alone real music.

I waited for exactly that sentence upon first reading the original post. I mean, we ABX a lot - mp3 for example. Numerous tests around here have shown that people cannot percept missing frequencies above roughly 15 kHz. I´m afraid this thread will get sorted into the "mp3-bashing-audiophile-snake-oil" sort.

In exclusive mode, the client can choose to open the stream in any audio format that the endpoint device supports. In shared mode, the client must open the stream in the mix format that is currently in use by the audio engine (or a format that is similar to the mix format). The audio engine's input streams and the output mix from the engine are all in this format.

Exactly. Figuratively speaking, WASAPI is nothing more but a revamped XP Audio Kernel with a few added traits ASIO had established.

To get back to the original post, I find it disturbing that Windows 7 actually resamples that bad. I always was under the impression that the resampling improved from XP to 7. Guess I was wrong. Have you measured any other things beside frequency response? Thinks like distortions? I wouldn´t be surprised if something gets aliased back into the audible range.

Windows 7's resampling sucks

Are you telling me that when I have set 24bits 96Khz in Sounds, and use Wasapi output in foobar2000 to play a 44Khz file, the wasapi driver in foobar is doing its own resampling to 96Khz without me knowing it?

The post you gave is from 2005, and as it can be read in it, not even beta 2 of Windows Vista was released. Also, it is not explicit if he was talking about Wasapi in general, or specifically about exclusive mode. (Or even if exclusive mode was the only mode that was to be made available at that time)

Windows 7's resampling sucks

Surprisingly related. And surprisingly, low-frequency artifacts are created, at least when when resampling from 44.1 to 48 kHz (the default setting on my Windows 7 installation). Can you confirm this for 192 kHz?

Edit: Hmmm, only "sucks" when using the "Microsoft Sound Mapper", or "Wave Mapper", or however it may be called, as output device.

Windows 7's resampling sucks

Is there any reason the OS' resampling even matters? If it's bothersome to hear, or even from a "I know _____ and it bothers me", then anything worth listening to w/o that "problem" can simply be played through a player that performs its own resampling. Virtually every player lets you do this, probably with something good enough that isn't complainable. Who cares if your windows sounds or some crappy youtube vid has been upsampled and has a high range falloff? If it only matters for music and videos, just resample in your player if you absolutely cannot stand something in the OS.

tl;dr: If you don't like one thing's way of doing something, use what you believe to be a better version of it.

Windows 7's resampling sucks

Did you take the effects of different recontruction low pass filters into account?

A few months ago I went through some datasheets of audio codecs (just out of curiosity) and discovered some plots that showed this behavoir. This was the case with one or two low cost chips. As most of the filtering is done in the digital domain (hopefully FIR) they may not have used enough coefficients to make steep filters at those rates.I may be totally wrong on this, though.

Concerning the original problem:Resampling, done right, shouldnt hurt. If there is no content beyond 48kHz, use this as sampling rate. 44.1kHz content will be resampled, either by your player, or by windows. I'm pretty confident the results won't be that significant (for measuring, that is) as the ones you posted.

Windows 7's resampling sucks

[quote author=[JAZ] link=msg=743051 date=1297291791]Are you telling me that when I have set 24bits 96Khz in Sounds, and use Wasapi output in foobar2000 to play a 44Khz file, the wasapi driver in foobar is doing its own resampling to 96Khz without me knowing it?

The post you gave is from 2005, and as it can be read in it, not even beta 2 of Windows Vista was released. Also, it is not explicit if he was talking about Wasapi in general, or specifically about exclusive mode. (Or even if exclusive mode was the only mode that was to be made available at that time)[/quote]

I posted a link to the current MSDN documentation an it is telling you exactly that.

Windows 7's resampling sucks

Were you able to ABX that? 1dB of rolloff at 17kHz seems like it would be difficult enough with test tones, let alone real music.

I waited for exactly that sentence upon first reading the original post. I mean, we ABX a lot - mp3 for example. Numerous tests around here have shown that people cannot percept missing frequencies above roughly 15 kHz. I´m afraid this thread will get sorted into the "mp3-bashing-audiophile-snake-oil" sort.

While it's preferable that audibility should be verified, in contrast to MP3 technologies such as resampling should not (for lack of a better phrase) mess around with the audio (the frequencies they preserve), so isn't there some merit to reporting deficiencies like these, regardless of audibility? Then it wouldn't be a case of saying "This sounds worse/awful", just "This has been subjected to sub-par processing".

Even compressed they wouldn't have fit into my upload contingent, so please excuse the system circumvention and feel free to move the files.

PS The RMAA analyzer will show insane IMD errors for both files. That's because it tries to deduce the tested sample rate from the file's sample rate. FR measurements aren't affected, though. When you resample to 44.1 kHz before scanning, IMD will look normal.

Windows 7's resampling sucks

@googlebot , I do not fully understand why you're so sure it is a Windows 7 thing, couldn't it be the hardware (@192kHz)? Unless you meant to say you tested the same hardware with Windows XP. Also the device driver will be different, of course.

I think you should really try 44.1 -> 96kHz and check if that is OK.

In theory, there is no difference between theory and practice. In practice there is.

Windows 7's resampling sucks

How do you base such claims. The audio system has undergone a huge rewrite. ASIO isn't faster than WaveRT and there is a nice, modular architecture for any additionally needed features.

I wrote "figuratively speaking". This wasn´t in any way meant as criticism. Compared to XP it has improved very much. But it cannot be ignored that they included "Exclusive Mode" for people who need it (e.g. people who need low latency). The people who formerly used ASIO for that reason (or may still be using it). IMO, Microsoft wanted a piece of the "audio-production-cookie". Granted, that´s guessing.

While it's preferable that audibility should be verified, in contrast to MP3 technologies such as resampling should not (for lack of a better phrase) mess around with the audio (the frequencies they preserve), so isn't there some merit to reporting deficiencies like these, regardless of audibility? Then it wouldn't be a case of saying "This sounds worse/awful", just "This has been subjected to sub-par processing".

Yes, I meant exactly that. I´m all for making something like this known so that it can be avoided. I only fear that this - in my eyes - important thread will vanish because of the usual "you can´t hear it anyway if frequencies beyond 15 kHz are missing". I wanted to write that googlebot was fighting windmills but I thought it to be insulting to the others so I didn´t. Well, now I did and so I should have clarified my point.

Windows 7's resampling sucks

@GeSomeone That's possible. It didn't test this since the 192 kHz -> 192 kHz loop-back test was nice and flat (better than -0.5 dB at 50 kHz). I'm going to give it a try tomorrow. But you are right, maybe all this is just about my hardware.

Windows 7's resampling sucks

I also don't think -1 dB at 17 kHz and -3 dB at 18.25 kHz makes a difference in real listening situations. The early and slow rolloff has also advantages in theory (possibly lower delay, computationally cheaper).

Windows 7's resampling sucks

I also don't think -1 dB at 17 kHz and -3 dB at 18.25 kHz makes a difference in real listening situations. The early and slow rolloff has also advantages in theory (possibly lower delay, computationally cheaper).

Such anti-aliasing filtering is necessary in a sample-rate and digital-to-analog conversion. As Sebastian indicates, there are trade offs in filter design. You are comparing Microsoft's software filter to the hardware filter in the DAC. They are implemented differently and it is not surprising that you can measure and hear a difference. Have you done any measurements on XP to confirm that there's a regression in Win 7. I would not assume that removal of user settings implies reduced performance. It could alternatively mean that overall performance was improved to the extent that user settings are no longer necessary.

Windows 7's resampling sucks

I am well familiar with the technical details of resampling. There recently was an interesting [a href='index.php?showtopic=84373']discussion [/a]about reconstruction filters, where I participated, for example.

Have you done any measurements on XP to confirm that there's a regression in Win 7. I would not assume that removal of user settings implies reduced performance. It could alternatively mean that overall performance was improved to the extent that user settings are no longer necessary.

I remembered that Microsoft had claimed for the "best" setting to use a high-end polyphase filter in XP. It took me a while to dig up some reference. And after reading that what Microsoft used to call the "good" setting was simple linear interpolation, I think you have a point and they might just have removed the ultra-low-level options. From the measurements it is pretty clear that Windows 7 does not use linear interpolation anymore and they might have just kept the former "better" or "best" option.*

Still, anti-aliasing is not just a trade-off between pass-band quality and filter steepness. Both can be maximized at the cost of a third variable: CPU cycles. Compared to the vast power of even 5 year old commodity CPUs, Windows 7's frequency roll-off really is a little lame (it's not a phone OS). Music playback doesn't need a lot of resources on modern CPU's. Most of the time can be spent in the lower C states and the long pipelines must regularly flush without ever truly filling. In such a low usage scenario a little higher software utilization can often free-ride just by higher pipeline utilization. I certainly wouldn't mind having the option of not 99,9% but 100% transparency, without a limitation to what the majority would call normal music. Not because the difference would be so huge, but because of missing necessity. If a difference with whatever signal, even if can't be considered normal music, can be perceived, and CPU cycles are superabundant, then why be apologetic about it?

* I'm not planning to re-install XP just to get confirmation.

One more comment shared WASAPI: even shared WASAPI can switch the output sample rate to a rate different from the user-chosen, preferred output sample rate, when there are no conflicting streams. In such a scenario a shared WASAPI implementation can output audio without an application level resampler (you end up with no resampling at all). But such an implementation would be incomplete and throw an error, when you try to playback while a conflicting stream or system sound would occupy the engine with another sample rate. Even if the occupying source would also use shared mode.

Windows 7's resampling sucks

You nailed it, thank you very much! I just tested exactly that and probably would not have tried without your suggestion. At 96 kHz the output is flat to -0.3 dB at 20 kHz!

But I'm totally clueless right now why this is happening. As said, the 192 kHz loop-back test is flat up to over 50 kHz. If I playback 44.1 kHz with the same setting the roll-off is there. Same 44.1 kHz playback over a 96 kHz output sample rate: perfect.