|
Bitperfect
"Bitperfect" / "bit-exact" explained
What is "bitperfect", and what do I have to do for bitperfect playback?An important measure for the quality of a soundcard's SPDIF port is the capability of so called "bitperfect playback" - this term coins the ability to directly transmit sound data through its SPDIF port to a receiver (e.g. a regular home theater amplifier, a custom built DAC, etc.) without having any loss or degradation in the process. An obvious way of testing this is to play some wave file while recording the output signal at the SPDIF port with another soundcard: after synchronization of the played and recorded sound files, a bit by bit comparison of both files should result in no differences if both soundcards are bitperfect. There are easier ways to test this capability, they require however a receiver capable of decoding ac3 or dts. The basic assumption behind this test is that any kind of audio processing usually alters the ac3/dts frames in a way that corrupts them. The receiver fails to identify damaged ac3/dts frames and plays them like regular PCM audio which make them sound like white noise. By playing ac3 or dts audio embedded into a regular wave file (samples are available here), a playback chain (player software => kmixer/audio service => driver) can be tested for whether or not audio processing takes place: if the chain is bitperfect, the receiver decodes the DTS, and if the chain isn't, the receiver plays white noise. Most consumer grade soundcards aren't bitperfect by design: some sound hardware may be limited to only one sample rate to the effect that sound processing is mandatory (sample rate conversion in this case), in other soundcards' drivers there are annoying "features" which can't be fully disabled (e.g. karaoke, fake 3D sound, "crystalizer" and alike). The latter applies to the C-Media based soundcards: while the hardware is fully capable of bitperfect playback at a multitude of sample rates, all versions of the official driver process the sound. Some versions even cripple the sample size of the sound data from regular 16 bit down to 14 bit which results in a hefty loss of dynamic range (roughly estimated from 96dB/16 bit to 84dB/14 bit). In the professional grade market, customers expect their soundcards to be bitperfect for obvious reasons, and the drivers are specifically engineered for this. These soundcards often come laden with other features which are pretty much useless in a regular home theater/HiFi environment (e.g. multitrack recording). Moreover, they're manufactured in much smaller volume than consumer grade soundcards, hence their pricetag is usually tenfold or even more of what a regular consumer soundcard costs. So in essence, in the past there have been only two options for the audiophile user: either accept the deterioration of sound quality induced by the driver's processing, or bite the bullet and buy an expensive professional grade soundcard. Not anymore: after reading the specs of a C-Media chip, I decided to write my own driver from scratch which completely avoids processing. It is compatible to C-Media based soundcards which are widely available for a mere 20 US$/€. The result is a slim and sleek driver which runs on all major Windows operating systems. It supports bitperfect playback for 16 bit sound streams at sample rates of 44.1kHz, 48kHz, 88.2kHz and 96kHz - this effectively covers almost all music on CDs and subsequent formats as well as audio from DVDs on sale today. On the software side, there are some more obstacles: in order to play multiple sounds simultaneously, a so called "kmixer" / "kernel audio mixer" (XP, 2000) respectively "audio service" (Vista) which is part of the sound subsystem of Windows mixes them together and adjusts the volume of the resulting stream. Contrary to popular belief, the kmixer of Windows 2000 and XP doesn't modify the sound and is thus bitperfect if these four conditions are met:
Most parts of the sound subsystem of Windows XP/2000 including the kmixer run in the privileged kernel mode, and this poses a security threat because most drivers are badly written with regard to security. The sound subsystem has thus been completely rewritten for Vista so that most parts, including the audio service which provides the functionality of the kmixer, runs in user mode. Also, they've changed the internal format which is used for audio processing from 16 bit integer to 32 bit float. A sample size of 16 bit is commonly used on most media, but it's difficult to handle when it comes to audio processing. The new 32 bit float audio engine of Vista processes multiple audio streams a lot better with regard to audio quality than the old 16 bit kmixer of XP/2k. Unfortunately though, Vista's reimplementation apparently doesn't disable the sound processing when it isn't needed to the effect that the audio service is not bitperfect anymore - audio processing happens on all the sound data when the application uses only standard interfaces like DirectSound/MME (with the exception of DD/dts passthrough). For some users, it may be therefore necessary to bypass the kmixer/audio service alltogether for bitperfect playback. This can be done in either of these two ways:
If you have any comments or questions about the above topics, feel free to drop me an email or use the comment system below. |
Sign in to add a comment
Dogbert, I have been trying to find that chart you had created showing the differences between running XP, Vista (WDM drivers), and Vista (WaveRT drivers) in terms of whether they can take advantage of ks/asio or not.
Could you please provide a link to that page? Thank you!
When I moved the site to google code, I've decided to remove the page because it often led to confusion more than clarification, and minor things on it were incorrect.
I use xmplay with asio4all under Windows 7. Is this couple bitperfect? Does asio4all bypass the audio service (let's say that it's Vista like). THANKS!
From the first glance, yes. ASIO4All is a ASIO to KS wrapper, and KS overrides the audio service. In addition, you could try the WaveRT version of the driver and the WASAPI output plugin of XMPlay - please note you have to reduce the size of the plugin's buffer before it can be used.
I'll give it a try. Thanks again for your help!
dogber1,
Can you give any tips on how to program for the WASAPI "Exclusive Mode"? Can it be done using non-MS tools, such as Win32 Delphi, or must it be done using .Net or the like.? Is there documentation anywhere about writing Wxclusive Mode apps?
The MSDN has pretty comprehensive documentation. A code sample is available here. I don't know whether there are any headers for Delphi - presumably there aren't any so you have to generate them yourself.
Need to know if the output is still bitperfect if I use the kmixer to adjust volume (wave slider) with your driver on XP/Vista/7 - as far as I understand it will not be bitperfect unless the volume is set to max?
I need to use the driver together with a home made DAC and a power amplifier connected directly to the DAC. E.g. I have to adjust the volume in windows!
if you set the volume in windows or in the signal player, you apply some kind of processing to the signal and it's not "bitperfect" anymore. whether or not this actuallly degrades quality is another discussion.
Are these C-Media chipsets limited to 16bit 96kHz even with your driver? If so, what h/w is needed to get "bitperfect" 96kHz 24bit audio data from a SPDIF output on PC with windows XP?
Thanks.
The C-Media chipsets seem to be indeed limited to 16 bit audio. I haven't got material which is encoded in 24 bit resolution, and considering the harsh requirements on jitter for this, I very much doubt that it's a sensible choice, so I haven't bothered to look for 24 bit hardware.