Thursday, May 22, 2008

Vista Audio Playback, Part 2

I've been pretty busy lately, so haven't had time to post any articles. Earlier today I received a nice email from someone (won't mention names unless I have permission) who's also a big HTPC proponent. He mentioned that he's been following Amplio Audio and anxiously awaits updates on our amps and our next article about Vista audio playback. Well, that was the kick in the ass I needed.

BTW, if you read an article that you would like me to follow up on, or have any questions, please feel free to use the comments at the end of the posts. I realize that most people are comfortable with email, but I'd like to see these articles become more of an open conversation that anyone can contribute to.

Anyhow, back to the topic... In the original Part 1 article I mentioned comments I read in a thread on diyAudio titled "Is Vista really capable of bit perfect output?" The original poster started by explaining that the sound quality when playing audio/music with his computer was better than using his expensive dedicated audio components. There are a couple of reasons some may believe a computer based audio system can never sound as good as dedicated stand-alone components. One is that the computer is just too electronically noisy to pass an analog signal without some distortion. The second reason is that the computer software and/or operating system modifies the audio data before passing it to the soundcard and DACs, thus distorting and/or damaging the sound quality.

There are several ways to avoid the first problem. One is to purchase a good quality soundcard that is properly shielded from any electro-magnetic interference. The other is to use a product who's analog circuitry is external to the PC. All FireWire and USB based soundcards fall under this category, as do a new generation of USB DACs. The product Amplio Audio is working on falls under this category as well. Up to this time, we have been using FireWire and it still proves to be the best technical solution.

The second problem is a little more complicated. Sound degradation caused by the operating system was true with Windows XP and standard WDM drivers. XP's audio engine relied on a mixer (KMixer) that would resample all audio to 48 KHz so everything output from the PC would use the same sample rate. There are some ways to avoid resampling, but if you adjusted the volume or simultaneously allowed sound output from other applications (including system sounds), resampling was performed. That means the CD's 44.1 KHz sample rate was always converted to 48 KHz. Another problem with this audio engine was that to lower the sound volume, the data was simply truncated to a lower resolution. So 16 bit audio was reduced to 14, 12 or 10, etc., bit data to get a lower volume. This can dramatically decrease the sound quality.

This is where the thread then moves on to the bit-perfect discussion. To avoid degrading the sound by modifying or truncating the bits, you could use a driver like ASIO that bypasses the Windows audio engine so that the original source audio data is not changed all the way to the DACs. This is how you could get bit-perfect output. Of course the software players had to provide support for these sort of drivers. Windows Media Player or Windows Media Center do not. So you had to use other players like J.River's Media Center, Winamp (with a special ASIO plug-in), Foobar, etc., to achieve bit-perfect performance. Now with Vista, a couple things have changed. First, the audio engine is much better. Even if the audio is resampled, the algorithms are much better and the effect on sound quality is not nearly as bad as what happened in XP. They've also improved the volume control so that they no longer truncate the bits to reduce sound levels. Instead, it converts the data to 32-bit floating point, then performs the volume adjustment calculations and then converts back to the original sample rate. This basically gives you lossless attenuation. It's not bit-perfect, but there is no degradation in sound quality. Some dedicated audio hardware that uses high quality DSP chips use this same technique. For the purist, who still want bit-perfect operation, they can still use ASIO drivers if they've been updated to work under Vista. These drivers will also bypass the audio engine, just like they did with XP. Vista also supports a new feature called "exclusive mode". Exclusive mode also bypasses the Vista audio engine and will provide bit-perfect playback. However, you need an application that supports exclusive mode and most I'm familiar with, like J.River Media Center, Windows Media Play, Vista Media Center, Foobar, etc., don't.

Getting back to the diyAudio thread, the bit-perfect discussion mentions that there is a newer software player, called XXHighEnd, that uses Vista's exclusive mode. There's another program called XMPlay that can run in exclusive mode when using a WASAPI output plugin. The sound output from a program using an ASIO driver or running in exclusive mode should be identical, because bit-perfect is bit-perfect. However, several people, including the original poster and the developer of XXHighEnd (not the same person), claim that XXHighEnd sounds better than other bit-perfect solutions. In fact the original poster was also a big fan of using Foobar with ASIO drivers, and he claims the sound has improved a lot when using XXHighEnd. When asked how something that outputs the exact same data can sound better, the developer doesn't provide any answers that satisfy the skeptics. The closest he comes to any technical explanation is that he does something to minimize jitter. But that doesn't make much sense given the way the audio chain works. If the audio data is buffered and the DAC is driven by a local clock, the audio software player shouldn't have any effect on jitter. He also admits that he doesn't know why it sounds better, but that there are many ways a software application can have an effect on the audio quality and he's just been tinkering around trying to find the best sound quality. That's where things get confusing to me. Or as another poster/skeptic put it:
  1. It's bit-perfect
  2. PCM needs to be processed some special new way to sound best
  3. No, it's bit-perfect
  4. If you were to, say, play a byte later in the stream than it was originally, that might be useful
  5. No, really, it's bit perfect!
  6. You're mucking around with the data based on some theories you have that you won't explain and if we don't just accept that it is bit perfect and magically sounds better than we are just mean, old unbelievers.
  7. Oh, and it is bit perfect.
The developer of a kernel streaming (KS) output driver, which is also achieving bit-perfect performance like ASIO drivers, compared the output from three different bit-perfect solutions - Foobar2000 with his KS output driver, XMPlay running in exclusive mode and XXHighEnd running in exclusive mode using it's third engine. Using an oscilloscope, he found that the output was identical. They are all bit-perfect. He also says he cannot hear any difference, so he doesn't recommend the XXHighEnd software because they charge for it (and Foobar2000) is free, the user interface is pretty weak and the program is immature. Like I said, others, including the original poster, claim it sounds better.

I have to admit, if it sounds good to you, I'm not going to try to convince you otherwise. I'm also not convinced bit-perfect output is the only acceptable way to listen to audio. Especially since Vista is not bit-perfect, unless you use exclusive mode, but it still sounds great because any changes are lossless.


  1. Thank you for interesting articles!

    I set up a bit perfect solution a while ago, then in XP, now in Vista.
    I'm playing FLAC and some MP3 from a vast library.

    Here's my setup chain:

    Windows XP SP2 >
    Winamp v5.531 >
    Kernel Streaming Output v3.63 (out_ks363.dll) >
    Terratec Aureon Dual USB (optical out,very chip usb soundcard) >
    Shanling DAC-1 (optical in, high-end dac with 96/24 upsampling) >
    Atoll Electronique AM100 (poweramp) >
    Dynavoice Challenger M-65 (very cheap, big, 3-way speakers, testing for fun)

    This setup is the best sound I've heard from a computer setup, though the speakers are destroying all the fun and will of course be exchanged


    When I used Windows XP and the Edirol the sound was good through kernel streaming. Then I bought the
    Terratec Aureon wich is the cheapest way I found to just get optical out from your computer (I borrowed the Edirol). It cost me about 40$ in Norway, while the Edirol which is a professional audio product costs about 150$ in Norwegian stores. While the Edirol has ASIO drivers, you don't really need them if you aren't into music production, as long as the drivers for the cheaper stuff are good enough (meaning supporting kernel streaming in my case).

    Now that's where my problems started. The Aureon is advertised as a "driverless" USB sound card.
    It uses the standard "USB Sound card" driver in XP.
    This didn't work at all with my computer and I got all kinds of problems. My DAC went crazy changing samplerate every second (long delay when changing), sound was choppy and sometimes didn't work, kernel streaming didn't work at all etc. I tried reinstalling, finding newer driver, configuring driver/sound card in windows and whatever else I could do. I don't know about other peoples setups but I'm guessing the driver is just crap. Terratec are known for bad drivers I also read somewhere.

    I had a couple of Vista licenses in my drawer from school, and though I
    didn't become a big Vista back when
    we tested it in school I decided to try it out again now, given also that I had read that audio handling in Vista was much better than the primitive and degrading handling in XP.
    The Aureon was discovered and installed without problems as expected and still has the name "USB Audio Device" in Vista.
    The driver itself however functioned like a dream compared to XP. Sound from my tv-card sounds very good, noticeable better than in XP, audio quality in videos is also very good. But the cream of the crop was Winamp with Kernel Streaming that blew me away a bit.
    I just had to sit put listening to the whole "Kraftwerk - Die Mensch-Maschine" album in a stretch. I'm guessing trying the setup out at a later time with some
    speakers giving more tribute to the
    DAC and poweramp will blow me even further, hehe.

    I have a couple of questions though; How can I get even better quality out of my other sources on the computer? Is bit perfect sound possible when eg. watching a divx/dvdr/hd material through a standard software player? Or when watching TV through my cheap tv-card.

    Regards, Lars, Norway.

  2. Lars-

    I'm not sure why you were having problems with bit-perfect playback under Windows XP. The drivers we've been using support ASIO and we aren't passing the LPCM out an optical port to an external DAC. We are simply passing the LPCM data via I2S to the DACs, which after I/V and filters is connected directly to amps.

    This works pretty well. With Vista, we can't hear much difference between the sound quality when setting our device to bypass the mixer using ASIO or from using the mixer and Directsound. Vista's audio functions are pretty tranparent. They convert the 16 bit integer values to 32 bit floats, then perform the adjustments, then convert back to 16 bit integer. This means there's no loss in resolution anymore.

    I would assume the software playing other material like divx videos would have to support ASIO or kernel streaming for you to get bit perfect playback. The software player decodes the audio/video data, just like the audio players decode FLAC, MP3, etc. into PCM. After that, if it passes the PCM data to the DACs you should be bit perfect. I know Vista Media Center (VMC) and Windows Media Player (WMP) don't do this, but maybe Zoomplayer does.

    The audio tracks from a divx video, recorded HD videos or DVD (especially Dolby Digital AC3 encoded) are so compressed, that I doubt you will hear any improvement from using a bitperfect path versus using Vista's audio mixer. Especially since the difference is hardly noticeable when playing lossless 24bit/96Khz audio with an audio player.

  3. Lars,

    Even two bit-perfect setups can sound different. Here's how:
    * source material is 16-bit
    * DAC/soundcard is 24-bit
    Now you can have the 8 least-significant bits all set to zero, but you can also interpolate them from several samples behind (and ahead). Different interpolation methods do yield different sound -- even when both are 16-bit perfect!

    Interpolation can dramatically reduce IMD for complex waveforms at low level if done right (and that's quite an "if" because the game is played 96dB below peak, usually by tin-eared programmers who hardly understand it -- and can never see the results on a 'scope).

    To make things only more complex, pretty much all source materials have LSB dithering (which is yet another form of interpolation, using different algorithms which interact differently with your own interpolation!). Also, some soundcards take the liberty to interpolate low-resolution data without "telling" you; consistent results require a traceable listening setup -- which is hard to come by (read: does not happen unless you design for it).

    To try and hear the difference for yourself, a good place to start is sibilance on low-level female vocal (decent mastering employs de-"essing" techniques, so noticeable sibilance would pretty much all come from IMD of your own setup and equipment).

    Human vision is wonderful, yet it fails to spot 1%THD on a 'scope. On the other hand, differences at -96dBFS are easy to hear on -40dBFS complex waveforms... Now you go explain this to the guys who claim that CD players all sound "the same" :)

    -- On (yep, that's my name)

    P.S. Sorry for the plug, but FooBar2000 comes in very handy for such listening tests: it uses effective (if simple) interpolation and offers a clean data path (including ASIO/kernel-streaming).