Hydrogenaudio Forums

Hydrogenaudio Forum => General Audio => Topic started by: googlebot on 2011-02-09 19:30:23

Title: Windows 7's resampling sucks
Post by: googlebot on 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?
Title: Windows 7's resampling sucks
Post by: [JAZ] on 2011-02-09 19:41:44
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.
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-09 20:14:38
[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 (http://blogs.msdn.com/b/larryosterman/archive/2005/12/07/501306.aspx), 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.

[quote author=[JAZ] link=msg=743017 date=1297280504]
(which isn't as big as you try to suggest. It's 7dB! )[/quote]

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.

[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]

Please consider using adequate facts in this forum. Posting completely opposite nonsense is not adequate information.
Title: Windows 7's resampling sucks
Post by: saratoga on 2011-02-09 20:56:53
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.
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-09 21:11:41
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.
Title: Windows 7's resampling sucks
Post by: Roseval on 2011-02-09 22:04:55
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

WASAPI in shared mode sends the output to the audio engine. The audio engine will match the source with the capabilities of the driver and will resample to the settings in the audio panel.
http://thewelltemperedcomputer.com/SW/Wind...7/Win7Audio.htm (http://thewelltemperedcomputer.com/SW/Windows/Win7/Win7Audio.htm)

According to dCs, the SRC in Vista is not perfect: http://thewelltemperedcomputer.com/Lib/Ope...SampleRates.pdf (http://thewelltemperedcomputer.com/Lib/OperatingSystemsHandlingOfSampleRates.pdf)

Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-09 22:11:06
WASAPI in shared mode sends the output to the audio engine. The audio engine will match the source with the capabilities of the driver and will resample to the settings in the audio panel.


The audio engine is responsible for mixing. When a shared WASAPI source has a non matching sample rate, it cannot use the engine. Your references do not say otherwise.

User-Mode Audio Components (MSDN): (http://msdn.microsoft.com/en-us/library/dd316780(v=vs.85).aspx)

Quote
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.
Title: Windows 7's resampling sucks
Post by: Cavaille on 2011-02-09 22:43:03
[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.

Quote
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.
Title: Windows 7's resampling sucks
Post by: [JAZ] on 2011-02-09 22:49:51
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)

Oh, and btw, i know what WASAPI exclusive mode is. I'm developing an output driver for my application which uses that.


I still don't understand how did you do that.


Win 192 -> analog(?) -> OSX 96Khz  -> something -> RMAA 44Khz
Win 44 -> analog(?) -> OSX 96Khz -> something -> RMAA 44Khz

Quote
The difference is at most 2dB, where it matters,
So... where it matters is at 18Khz? If you say so...
Title: Windows 7's resampling sucks
Post by: C.R.Helmrich on 2011-02-09 22:50:29
http://www.hydrogenaudio.org/forums/index....st&p=693667 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77994&view=findpost&p=693667)

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.

Chris
Title: Windows 7's resampling sucks
Post by: SCOTU on 2011-02-09 22:51:36
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.
Title: Windows 7's resampling sucks
Post by: soulsearchingsun on 2011-02-09 22:56:53
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.
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-09 23:07:40
[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.

[quote author=[JAZ] link=msg=743051 date=1297291791]
Oh, and btw, i know what WASAPI exclusive mode is. I'm developing an output driver for my application which uses that.[/quote]

Then I wonder how you can write sentences like "One has to resample only if it uses exclusive mode", which is simply false according to the past and current developer documentation.

[quote author=[JAZ] link=msg=743051 date=1297291791]
I still don't understand how did you do that.

Win 192 -> analog(?) -> OSX 96Khz  -> something -> RMAA 44Khz
Win 44 -> analog(?) -> OSX 96Khz -> something -> RMAA 44Khz[/quote]

It's really no black magic:

RMAA (44.1 kHz) -> DirectSound -> DA (44.1 kHz) -> Line Out (PC) -> Line In (Mac) -> AD (96 kHz) -> WAV -> RMAA Analyzer
RMAA (44.1 kHz) -> DirectSound -> DA ( 192 kHz) -> Line Out (PC) -> Line In (Mac) -> AD (96 kHz) -> WAV -> RMAA Analyzer


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


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.
Title: Windows 7's resampling sucks
Post by: db1989 on 2011-02-09 23:10:35
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".
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-09 23:25:19
I'll be away until tomorrow night. If you guys come to the conclusion that I just wrote a bunch of BS, so be it. If you need additional basis for claims in whatever direction, here you go:

These are links to the two RMAA recordings on Rapidshare. I enabled Trafficshare mode, so you don't need to register to download with full speed:

http://r  apidshare.com/files/447079428/441192.wav
http://r  apidshare.com/files/447078121/441.wav

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.
Title: Windows 7's resampling sucks
Post by: GeSomeone on 2011-02-09 23:42:17
@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.
Title: Windows 7's resampling sucks
Post by: Cavaille on 2011-02-09 23:47:30
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.
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-09 23:50:09
@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.

I gotta go now, don't wanna upset the sandman.
Title: Windows 7's resampling sucks
Post by: SebastianG on 2011-02-10 10:28:20
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).
Title: Windows 7's resampling sucks
Post by: soulsearchingsun on 2011-02-10 10:45:32
Did you take the effects of different recontruction low pass filters into account?

[...] the 192 kHz -> 192 kHz loop-back test was nice and flat (better than -0.5 dB at 50 kHz).

My point is invalid then.
Title: Windows 7's resampling sucks
Post by: Notat on 2011-02-10 15:43:40
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.
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-10 19:46:45
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 (http://msdn.microsoft.com/en-us/library/ff537758(v=vs.85).aspx). 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.
Title: Windows 7's resampling sucks
Post by: lvqcl on 2011-02-10 21:17:17
http://blogs.msdn.com/b/matthew_van_eerde/...-pull-mode.aspx (http://blogs.msdn.com/b/matthew_van_eerde/archive/2008/12/10/sample-playing-silence-via-wasapi-event-driven-pull-mode.aspx)
http://blogs.msdn.com/b/matthew_van_eerde/...t-you-hear.aspx (http://blogs.msdn.com/b/matthew_van_eerde/archive/2008/12/16/sample-wasapi-loopback-capture-record-what-you-hear.aspx)

Is it possible to test Vista/Win7 SRC quality with this small app? If yes, then 192->44.1kHz or 44.1->192kHz SRC isn't that bad...

(http://img716.imageshack.us/img716/1448/src01.png)
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-10 22:32:33
Interesting. Looks like it should, just not like what I get.
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-10 23:00:17
I think you should really try 44.1 -> 96kHz and check if that is OK.


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.

The codec is an ALC889, driver version 6.0.1.6201.
Title: Windows 7's resampling sucks
Post by: [JAZ] on 2011-02-11 00:05:00
Couple of things...

It looks like foobar2000 implementation of WASAPI uses the exclusive mode. (it doesn't allow other apps to make sound when playing)
I've managed to implement the shared mode, and indeed I wasn't right. The documentation doesn't explicitely say that you cannot use another setting than the one returned to you by the call to GetMixFormat() (Ok, it says it in the page you pointed, but that's not explained in the interface definitions). On the other hand, at least the bitdepth is 32bit float.

In this case, you are right that an application using the shared mode would need to have a resampler if it wants to use multiple samplerates.


I also took the time to install rmaa6 and test this laptop's integrated soundcard with a loopback cable. The results I got are like yours, but I still think you exaggerated.
Having 16bit 44Khz in rmaa, 16bit 192Khz in speakers, and 16bit 44Khz in line in gives me the same graphic that you got (the one with smooth rolloff). If I use 16bit 44Khz -> 16bit 96Khz -> 16bit 44Khz, then the rolloff is still stronger, yet not by much more.

Having all three set to 16bit 44Khz in all doesn't give me as good a graphic than you, it is just partially better, and using 16bit 96Khz in all gives me a very nice response.
comparisons (http://psycle.free.fr/josepma/comparative-resampling.png)
96Khz (http://psycle.free.fr/josepma/16bits96Khz-16bits96Khz-16bits96Khz.png)
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-11 00:53:54
Thank you for the update [JAZ] and my apologies for my sometimes harsh replies.

I extended RMAA's standard zoom setting to the right with interesting [a href='index.php?act=findpost&pid=743196']results[/a]. Are your's comparable, when you record with a higher sample rate?

The results somewhat confuse me. The 44.1->44.1 noise could be a DAC artifact. But why differ the other two curves the way they do, when 192-192kHz loopback works fine?

Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-11 02:20:39
The problem is mostly solved. It seems to be a really obscure bug. All analog 192 kHz output gets low-passed at 20 kHz unless you are concurrently recording at 192 kHz!!! That's right, pure 192 kHz playback - whatever you have locally set as recording sample rate - and captured by another computer will get a 20 kHz low-pass, but a local RMAA test will show a super-flat bandwidth of over 50 kHz. Since I almost exclusively used 44.1 kHz source signals in RMAA this almost drove me  . Sending a 192 kHz test signal to the second computer was a very desperate, last attempt (and finally eye opener). The HF roll-off is a result of low-passing twice, first by DirectSound and then again due to the bug.

The 44.1->44.1 and 44.1->96 modes only undergo no or just one (proper) resampling by DirectSound. And the quality is fine!

This makes the topic title misleading. I propose changing it to "How I got 0wn3d by a b1tch ca113d ALC889".
Title: Windows 7's resampling sucks
Post by: soulsearchingsun on 2011-02-11 12:05:55
The HF roll-off is a result of low-passing twice, first by DirectSound and then again due to the bug.

Why should DirectSound do 20kHz lowpass-filtering if you're using 192kHz sample rate on the output?
Your signal will imho be lowpass-filtered twice, once in the output stage at around 40-50kHz (if your codec is good) and once in the input stage at 20kHz (recording at 44.1kHz). If this bug is really hardware (or driver) related the codec (dac side) is lowpass-filtering at 20kHz. I have no idea why this should be the case.
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-11 12:09:31
Why should DirectSound do 20kHz lowpass-filtering if you're using 192kHz sample rate on the output?


Because the application outputs a 44.1 kHz stream. It's a side effect of upsampling.

Your signal will imho be lowpass-filtered twice, once in the output stage at around 40-50kHz (if your codec is good) and once in the input stage at 20kHz (recording at 44.1kHz).


The full chain is actually something like this:

Application (44.1 kHz) -> SRC (192 kHz) [LP@~22 kHz] -> DAC (oversampling to 192*n kHz) [1. digital LP@~96 kHz, 2. analog LP@~192*n/2 kHz] -> ADC [1. analog LP@~96*n/2 kHz, 2. digital LP@~48 kHz] -> Audacity (96 kHz)
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-11 12:13:14
Maybe we can get an additional confirmation? Personally, I would also scratch my head if I read this. The culprit is an ALC889 on an Intel DP55WG mobo.

PS Or the culprit is RMAA. I'm going to check this next.
Title: Windows 7's resampling sucks
Post by: soulsearchingsun on 2011-02-11 12:20:38
Maybe we can get an additional confirmation? Personally, I would also scratch my head if I read this. The culprit is an ALC889 on an Intel DP55WG mobo.

Datasheets are available. I'm looking into it atm.
edit: ALC889 Datasheet (http://ftp://208.70.202.219/pc/audio/ALC889_DataSheet_1.0.pdf) (mirror 1 from realtek page)
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-11 13:19:16
Full stop. It was just RMAA that fucked up. And with it I did ofc. I should not have relied on a single tool. When I playback and capture white noise manually wit Audacity, everything works as expected at all sample rates, including 192 kHz. There is no 20 kHz low-passing at 192 kHz. It is just RMAA that behaves strangely at 192 kHz with the ALC889. At 96 kHz and below it measures full-spectrum. Set to output 192 kHz in non-loop-back mode it falls back to just 20 kHz bandwidth. But in loop-back mode it tests the whole 96 kHz bandwidth. Next I will try to reproduce the HF roll-off manually with Audacity. Maybe that was also just RMAA.

PS I also cannot reproduce the 44.1->192kHz roll-off with Audacity.

For the record: Windows 7's resampling is fine!
Title: Windows 7's resampling sucks
Post by: Cavaille on 2011-02-11 14:15:01
Full stop. It was just RMAA that fucked up. And with it I did ofc. I should not have relied on a single tool. When I playback and capture white noise manually wit Audacity, everything works as expected at all sample rates, including 192 kHz. There is no 20 kHz low-passing at 192 kHz. It is just RMAA that behaves strangely at 192 kHz with the ALC889. At 96 kHz and below it measures full-spectrum. Set to output 192 kHz in non-loop-back mode it falls back to just 20 kHz bandwidth. But in loop-back mode it tests the whole 96 kHz bandwidth. Next I will try to reproduce the HF roll-off manually with Audacity. Maybe that was also just RMAA.

PS I also cannot reproduce the 44.1->192kHz roll-off with Audacity.

For the record: Windows 7's resampling is fine!
Actually, that´s a relief. Then it´s true what they wrote when they presented the new engine: it has improved. Maybe RMAA has problems with onboard codecs...    I once did a test with my onboard VIA VT1708s and also found that it couldn´t process 192 kHz despite it being advertised as being able. But then, maybe it´s RMAA. When I tested my ASUS Xonar Essence ST with an analogue loopback, RMAA gave me a perfectly flat response for all sample rates with +/- 0.2 dB. Out of curiosity I tested the same with pink noise generated by AudioDiffMaker - which gave me a + 1.5 dB bump at lower frequencies combined with a soft rolloff at higher frequencies starting at 10 kHz reaching -2 dB at 20 kHz. I still don´t know which one of the programs measured incorrect.
Title: Windows 7's resampling sucks
Post by: greynol on 2011-02-11 18:51:54
What about your initial suspicion about muffled sound?

I couldn't longer ignore the impression that the resampled output sounded somewhat muffled and did some measurements.

Title: Windows 7's resampling sucks
Post by: googlebot on 2011-02-11 19:27:09
What about your initial suspicion about muffled sound?


Schoolbook placebo?
Title: Windows 7's resampling sucks
Post by: hellokeith on 2011-02-13 03:06:41
Googlebot,

This thread was actually helpful, in that it forced me to look at my Foobar wasapi setup, which I had done incorrectly.  I had been under the impression that FB wasapi was shared mode, but it is indeed exclusive.  Switching back and forth between Speakers and wasapi as fast as I can click, I don't really hear a difference, but at least I know how to force exclusive mode now.
Title: Windows 7's resampling sucks
Post by: Greg on 2011-04-17 08:51:11
http://blogs.msdn.com/b/matthew_van_eerde/...-pull-mode.aspx (http://blogs.msdn.com/b/matthew_van_eerde/archive/2008/12/10/sample-playing-silence-via-wasapi-event-driven-pull-mode.aspx)
http://blogs.msdn.com/b/matthew_van_eerde/...t-you-hear.aspx (http://blogs.msdn.com/b/matthew_van_eerde/archive/2008/12/16/sample-wasapi-loopback-capture-record-what-you-hear.aspx)

Is it possible to test Vista/Win7 SRC quality with this small app? If yes, then 192->44.1kHz or 44.1->192kHz SRC isn't that bad...

(http://img716.imageshack.us/img716/1448/src01.png)


How exactly was this Adobe Audition plot made?
What was the source sweep file derived from?
What Play and Record applications were used?
I am curious about the complete procedure used here.

I am in the process of analyzing and documenting Windows SRC performance between Windows XP and Windows Vista/7. It seems as though Windows Vista/7 Record SRC using emulation mode is a problem. Play seems fine. Most Windows applications are still using Wave emulation mode, and unless the target hardware sample rates are respected, Windows Vista/7 will do a pretty horrible job of SRC in Record. This is not true of XP. I have tried to contact Microsoft numerous times regarding this, but they are apparently not available for comment.

The best way I've found to test this is to use VAC, eliminating any possible hardware driver problems.
Title: Windows 7's resampling sucks
Post by: jaro1 on 2011-04-17 11:20:20
This area has also my interest, however the problem are non-existent sources,tests or other material about it. I'm still unclear in two things i've written earlier in HA about (this or other threads, don't know yet).

1. MF pipeline uses under its audio DSPs a resampler DMO, which can be used by developing audio apps and its accuracy (filter length) can be adjusted from 1 to 60 (default is 30). Don't know if this can be also adjusted with "normal" playback through e.g. WMP12, as this is to me the only known MF application.

2. I suppose this component isn't used for resampling when using other APIs, e.g. dsound, waveout, xaudio2 (Tuniac uses this "dsound" replacement for hardware acceleration under xp - this seems not to be the case with WV/7 however, but i'm not sure). But if this is true, where does the resampling take place in this case? In the APIs themselves or in mixing engine Audiodg.dll? And can the accuracy also be adjusted (under V/7)? Under XP this was possible, but there was another architecture and the resampling was probably situated in kmixer.sys

However i don't use JRMC, i've used it once to find out the resampler DMO precision, because it allowed me to include it into the audio path, not as DSP (all were disabled), but in file type handling it was possible to "pin" it to specified format, e.g. wav. Of course, disk writer was used for output.
As audio driver was hard-settled to 16/48, resampler DMO automatically processed audio to these values (so bit dither/bitreduction was applied also). As usual, swept24 (24/96) from here: http://src.infinitewave.ca/TestSignals.zip (http://src.infinitewave.ca/TestSignals.zip) was used for resampling.
The result is here: http://img571.imageshack.us/i/1648b.gif (http://img571.imageshack.us/i/1648b.gif)
Maybe this is with the default setting (30), don't know as adjusting wasn't possible in JRMC.
Title: Windows 7's resampling sucks
Post by: lvqcl on 2011-04-17 12:34:02
How exactly was this Adobe Audition plot made?

Select the whole audio, press Alt+Z, press "Scan Selection".

What was the source sweep file derived from?

IIRC it was just a pulse train.

What Play and Record applications were used?

Play: silence.exe + foobar2000 with DirectSound output.
Record: loopback-capture.exe
Title: Windows 7's resampling sucks
Post by: Greg on 2011-04-17 19:30:02
How exactly was this Adobe Audition plot made?

Select the whole audio, press Alt+Z, press "Scan Selection".

What was the source sweep file derived from?

IIRC it was just a pulse train.

What Play and Record applications were used?

Play: silence.exe + foobar2000 with DirectSound output.
Record: loopback-capture.exe


Any chance you can make the pulse train file available?
I would like to duplicate the results here.
Title: Windows 7's resampling sucks
Post by: lvqcl on 2011-04-17 19:57:25
I don't have it, but it was like the attached file.
And you can also use test signals from http://src.infinitewave.ca/TestSignals.zip (http://src.infinitewave.ca/TestSignals.zip)
Title: Windows 7's resampling sucks
Post by: whitejason on 2011-06-27 18:41:36
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?


I was having this same problem.  The speeds weren't matching up or sinking.  I was having trouble with muffling audio too.  Especially when I listened to it on my home theater system speakers.  I found that I was able to swap from using the motherboard sound to my other card and now I can get WASAPI to run at 44.1k without resampling.  I don't know if that will help you at all with your audio.  I don't know if that helped your or not, or will just confuse you.
Title: Windows 7's resampling sucks
Post by: meeky on 2011-11-05 06:05:50
Not sure if this is related, but Microsoft have confirmed that there is a bug in the sample rate converter in Windows 7. They also confirmed that the bug is not present in XP.

Details here:
http://social.msdn.microsoft.com/Forums/en...a-47e51de9c3ae/ (http://social.msdn.microsoft.com/Forums/en-US/windowspro-audiodevelopment/thread/725546ce-57bf-40d0-b7aa-47e51de9c3ae/)


Title: Windows 7's resampling sucks
Post by: lvqcl on 2011-11-05 06:36:24
from the abovementioned thread:
Quote
Media Foundation, DirectShow, DirectSound, and waveOut each do sample rate conversion slightly differently.  There is a bug in the waveOut sample rate conversion which results in a lower-quality sample rate conversion than was done in XP.
Title: Windows 7's resampling sucks
Post by: Woodinville on 2011-11-05 07:32:21
Have you done any measurements on XP to confirm that there's a regression in Win 7.


XP and Vista (and I believe W7) are so dissimilar that there is no means to compare them. One is fixed, one is float, one uses a polynomial resampler, the other a dedicated, high-quality resampler (unless you provide many, many inputs in which case it will drop the quality due to the demand on the CPU).

That is, if you use new, rather than legacy, system inputs.
Title: Windows 7's resampling sucks
Post by: hellokeith on 2011-11-05 09:01:10
Media Foundation, DirectShow, DirectSound, and waveOut each do sample rate conversion slightly differently.

I had to read that a few times before realizing that the majority of my audio & audio/video listening is done through DirectShow apps.  Do we know when waveOut is invoked? Is the problem only in 41<-->48 SRC or others?
Title: Windows 7's resampling sucks
Post by: lvqcl on 2011-11-05 09:47:09
http://blog.szynalski.com/2009/11/17/an-au...-7/#comment-592 (http://blog.szynalski.com/2009/11/17/an-audiophiles-look-at-the-audio-stack-in-windows-vista-and-7/#comment-592)

Quote
I generated a 40 Hz tone in Cool Edit Pro, both in 44.1 kHz and 48 kHz. Whenever the sample rate doesn’t match the Windows sample rate, I hear the same high-frequency distortion artifact.

Here are the results of playing a 44.1 kHz WAV file (40 Hz tone) in various apps with the Windows sample rate set to 48 kHz:

Cool Edit Pro 2.0 – distortion
Windows Media Player – no distortion
Foobar2000 – no distortion
iTunes 7 – no distortion
Winamp (with Directsound output) – no distortion
Winamp (WaveOut output) – distortion

In short, Directsound output upsamples correctly. WaveOut produces distortion.


I also tested 48 kHz WAV file and 44.1 Windows samplerate: waveout downsamples incorrectly too.
Title: Windows 7's resampling sucks
Post by: C.R.Helmrich on 2011-11-05 10:28:54
I just checked the optional updates available for my Win 7 installation. No sign of a SRC update. Instead, they offer e.g. a "blurry font fix" to the IE 9 font rendering with highly questionable results.
[attachment=6741:ie9_blurry_font.png]

What an interesting choice of priority. No, actually it's not interesting, it's sad.

Chris
Title: Windows 7's resampling sucks
Post by: Roseval on 2011-11-05 12:33:53
I'm afraid audio has priority zero at Microsoft
Likewise both OSX and Linux have native USB audio class 2 drivers from mid 2010 on.
Nobody knows if MS even have plans to implement this.
Title: Windows 7's resampling sucks
Post by: Batman321 on 2011-11-05 18:01:45
I just checked the optional updates available for my Win 7 installation. No sign of a SRC update. Instead, they offer e.g. a "blurry font fix" to the IE 9 font rendering with highly questionable results.
[attachment=6741:ie9_blurry_font.png]

What an interesting choice of priority. No, actually it's not interesting, it's sad.

Chris



 

True... IE9 looks horrible after that crappy update
Title: Windows 7's resampling sucks
Post by: googlebot on 2011-11-05 20:09:14
I'm afraid audio has priority zero at Microsoft


I do not agree. Since Vista Windows has the most advanced audio subsystem of all OSes out of the box. CoreAudio comes close, but it lacks an application controllable output sample rate.
Title: Windows 7's resampling sucks
Post by: Roseval on 2011-11-06 09:59:40
There are a couple of media players  for OSX doing automatic sample rate switching.
Just like in Win it is possible in OSX.
http://thewelltemperedcomputer.com/SW/OSX/Players.htm (http://thewelltemperedcomputer.com/SW/OSX/Players.htm)
Title: Windows 7's resampling sucks
Post by: Juha on 2011-11-06 10:52:37
So, you need dedicated playback software for to do that in OSX (AFAIK, samplerate switching isn't hard to implement when implemented in playback software)?

Juha
Title: Windows 7's resampling sucks
Post by: Roseval on 2011-11-06 12:03:17
Correct.
iTunes doesn't support automatic sample rate switching just like WMP on Win doesn't.
You need a thrid party media player to do so.
Title: Windows 7's resampling sucks
Post by: bennetng on 2011-11-06 12:11:01
I have to agree that win7's resampling has some problems. It only sounds good in DS mode but not in Wave out mode. I have a test file for test. Original wavpack file and a video demonstration is included. You can listen to the sound in the video. VERY BIG differences. Audio in the video is lossy encoded but it can still show the differences between DS and waveout.

http://s000.tinyupload.com/index.php?file_...990775897092133 (http://s000.tinyupload.com/index.php?file_id=39395990775897092133)

I don't really care WASAPI or ASIO or whatever has the best sound. The problem is that not all software have such mode for selection. For example, in Audition 1.5, I am having bad resampling no matter what I set in Audition's audio preferences.

This problem is not soundcard/driver related. Both my Edirol interface and Creative X-Fi have the same problem. They performed well in XP.


Title: Windows 7's resampling sucks
Post by: googlebot on 2011-11-06 14:19:10
There are a couple of media players  for OSX doing automatic sample rate switching.
Just like in Win it is possible in OSX.


On OSX you have to provide the functionality manually on the application layer. Windows can provide this automatically. I didn't claim that the actual end-user functionality is significantly different on both systems.
Title: Windows 7's resampling sucks
Post by: benski on 2011-11-06 17:24:34
from the abovementioned thread:
Quote
Media Foundation, DirectShow, DirectSound, and waveOut each do sample rate conversion slightly differently.  There is a bug in the waveOut sample rate conversion which results in a lower-quality sample rate conversion than was done in XP.



This makes sense of the prior conversation in this thread.  It's likely that the RMAA tool is using the older waveIn API where -as Audacity is using DirectSound (at least by default).
Title: Windows 7's resampling sucks
Post by: LordWarlock on 2012-03-09 18:49:56
For whoever it may interest, there is now a hotfix (not on Windows Update, it's on request only, but should be in next SP) that should fix this sucky resampler. KB2653312 (http://support.microsoft.com/kb/2653312)
Title: Windows 7's resampling sucks
Post by: C.R.Helmrich on 2012-03-09 20:21:58
Thanks a million, Lord! Trying it right now. Edit: I listened to my test file (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77994&view=findpost&p=693667) with resampling triggered, before and after the hotfix installation. No more aliasing to my ears. That must be one of the best MS hotfixes in years

[quote author=http://support.microsoft.com/kb/2653312 link=msg=0 date=]This issue occurs because the sample rate converter uses linear interpolation when it converts audio files.[/quote] *sigh*

Chris
Title: Windows 7's resampling sucks
Post by: extrabigmehdi on 2012-03-09 23:07:16
For whoever it may interest, there is now a hotfix (not on Windows Update, it's on request only, but should be in next SP) that should fix this sucky resampler. KB2653312 (http://support.microsoft.com/kb/2653312)

Or you could bypass win7 resampler by using wasapi...
Title: Windows 7's resampling sucks
Post by: Woodinville on 2012-03-10 00:51:52
For whoever it may interest, there is now a hotfix (not on Windows Update, it's on request only, but should be in next SP) that should fix this sucky resampler. KB2653312 (http://support.microsoft.com/kb/2653312)


They have a perfectly good 120dB SNR resampler. WTF did they make this necessary!?
Title: Windows 7's resampling sucks
Post by: hellokeith on 2012-03-10 09:17:49
Why a hotfix and not an update?
Title: Windows 7's resampling sucks
Post by: andy o on 2012-06-20 00:34:18
For whoever it may interest, there is now a hotfix (not on Windows Update, it's on request only, but should be in next SP) that should fix this sucky resampler. KB2653312 (http://support.microsoft.com/kb/2653312)

Or you could bypass win7 resampler by using wasapi...

I don't think this is relevant. Doesn't the Windows mixer work in DirectSound or WASAPI shared?
Title: Windows 7's resampling sucks
Post by: markanini on 2012-06-20 06:41:26
For whoever it may interest, there is now a hotfix (not on Windows Update, it's on request only, but should be in next SP) that should fix this sucky resampler. KB2653312 (http://support.microsoft.com/kb/2653312)


They have a perfectly good 120dB SNR resampler. WTF did they make this necessary!?

IIRC MME still used crappy linear interpolation. Some one else will have to confirm.
Title: Windows 7's resampling sucks
Post by: db1989 on 2012-08-29 18:22:34
Cross-linking for future reference:
“Windows 7/2008 have bug in SRC when recording via MME—hotfix available (http://www.hydrogenaudio.org/forums/index.php?showtopic=96737)”

I’d also like to take this opportunity to respond to this:
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.
[/size]Very bad logic. Users are perfectly entitled to complain about sloppy implementation of automatic processes, especially in the supposedly latest-and-best edition of the world’s most popular OS, used by millions. Saying there are other options isn’t good enough. Jumping through hoops just to neutralise someone else’s failure should not be considered acceptable. I also take issue with the implicit idea that only those who notice and can deduce the correct cause deserve proper/adequate quality. Audibility shouldn’t matter in contexts such as this, and you instantly dismiss people who notice but aren’t aware of digital audio’s internals and/or may conclude that some other part of their signal-chain is at fault.
SimplePortal 1.0.0 RC1 © 2008-2020