PDA

View Full Version : Music player


phunqe
2008-04-06, 14:32
Hi,

I've been using ASIO / Kernel audio playback with MediaPortal for greater sound quality and I'm wondering how music is played back in XBMC (currently or what the plans are).
Will/is it possible to do this in XBMC for window as well?

Cheers.

jmarshall
2008-04-07, 04:14
We use our own custom player.

Perhaps you could elaborate on this "greater sound quality" you speak of and exactly how said quality is achieved?

phunqe
2008-04-07, 09:50
Thanks for answering jmarshall.
Normal playing through Windows uses the kmixer (I don't know how you are playing the music back however), which tends to reduce sound quality due to crappy resampling to 48 kHz.
With greater sound quality I mean bit perfect playback, achieved by using ASIO or direct kernel streaming (which would output at 44.1 kHz).
It might sound like an audiophile thing, but there actually is an audible difference (of course, you music files needs to be of high quality as well). There are bit-perfect playback plug-ins to for example foobar and winamp.

See below for further explanation.


Bit Perfect / Bit Accurate

Lets start off with a bit of explination of how Windows handles audio.

What is the KMixer?

The KMixer is a part of Windows that enables your computer to take multiple audio sources and play them back at the same time and at the same bit rate. The KMixer is also how Windows handles your volume control. Regular CD audio is 44.1 kHz. Many times, due to poorly written drivers, sound cards that will interact with the KMixer wil cause this 44.1kHz data to be resampled to 48kHz. Obviously this will result in an undesireable result when trying to achieve the upmost in sound quality. The mixing algorithm as implemented by Microsoft has been shown in many cases to only have a signal to noise ratio of about 92dB. CDs have a signal to noise ratio of about 96dB (technically 97.5dB). The KMixer effectively reduces the data from 16bit to 14 bit.

To bypass the Windows KMixer you either need to use ASIO or Kernel Streaming.

ASIO

ASIO is a professional audio standard that provides for a low-latency audio stream from the computer. ASIO bypasses the KMixer entirely. ASIO is used by the recording industry as a standard. For more information on ASIO, please see here: MP3Car.com thread

Kernel Streaming

Kernel Streaming is just about the same thing as ASIO. It is Microsofts answer for being able to play audio files in a bit perfect format on a Windows machine. Kernel Streaming make efficient real-time streaming of audio possible. However, Kernel Streaming is not an industry standard. ASIO will have many more supported plugins avaliable for various media players. Kernel Streaming requires less CPU time than the regular ‘wave out method’.

What does this mean?

By bypassing the Windows KMixer and running either ASIO or Kernel Streaming, you are ensuring that you are hearing the music as it was encoded on the CD.

The downside to this? If there are errors on the CD, you will hear them as there is not any correction being made to overcome the error.

In essence, by runinng bit-perfect, you are ensuring that there is no difference in information between the CD that is being read and what makes its way out of the digital output of your sound card.

The quality of a sound card can have an effect on the quality of the output, even with bit perfect playback enabled. The timing and/or jitter can vary between sound cards, usually with the lower end sound cards having a higher likely hood of jitter.

Software:

For ASIO plug-ins:

Http://otachan.com (For a translated version of the page: Translated Web Page)

WinAmp5:

.dll version – From 10/4/2006
.exe version – From 10/4/2006
x64 version – From 10/4/2006

Foobar 2000:

.dll version – From 2/25/2005
.exe version – From 2/25/2006
.x64 version – From 2/25/2006


For Kernel Streaming plug-ins:

You can find a Kernel Streaming plug in for WinAmp 2 available here from Steve Monks: http://www.stevemonks.com/ksplugin/
For some discussion or possibly for some support on this plug-in, check this thread: Hydrogen Audio

For a Kernel Streaming plug in for WinAmp, as well as FLAC and VolumeLogic: Torrent Download

A note about this plug-in for WinAmp: Sometimes the play list will not advance automatically when a song finishes. You will have to manually press Next or select another song. This can be resolved by combining the Kernel Streaming plug-in with the VolumeLogic plug-in also included in this torrent. In Winamp’s output plug-in list, double click on VolumeLogic (setting it as the output plug-in for Winamp to use) and a window will pop up asking you to select the out put plug-in. Select Kernel Streaming from here. This will fix the play list advance issue so everything works. When you double click a song, however, rarely, it will not start. Just press pause twice and it will start like normal.


Audio Codecs that are capable of Bit Perfect:

* ACL880 and ACL882

The AC97 codec is NOT capable of bit perfect playback.

Some rules of thumb for bit-perfect:

* When Bit Accurate mode is applied to the playback, adjusting the volume control or applying EAX effects will not have any effect on digital output signals.
* Once Bit Accurate playback starts, the digital output sampling rate is automatically set to the current playback's sampling rate regardless of the current digital output sampling rate.
* Bit-perfect can only truly be tested using the tos-link out of either your sound card or a compatible audio codec for onboard sound for some motherboards and a DTS-decoder.
* Any software DSP or sound processing will cause the benefits of bit perfect to become null.
* Play with the buffering options. The buffer settings will vary depending on your system. Lower buffers are better, obviously as you will have a lower latency, however, if they are too low you will run into issues with audio drop-out with a system that is under a heavy load.
* Bit Accurate mode is only applicable to .WAV files with the following specifications:
o Stereo Format
o PCM audio data
o 16-bits and above (maximum 32-bits with 24-bits resolution)
o 44.1, 48, or 96 kHz
* Once Bit Accurate playback starts, the digital output sampling rate is automatically set to the current playback's sampling rate regardless of the current digital output sampling rate.


How do I know that I am getting bit-perfect?

If you have successfully achieved bit-perfect playback, you should be able to play a DTS file off of a CD (16-bit, 44.1kHz). If you only get static from trying to play the file, then you know that you haven’t achieved bit-perfect playback.

phunqe
2008-04-07, 09:59
The quote above is quite old however, there are excellent universal WDM drivers for ASIO at http://www.asio4all.com/

phunqe
2008-04-07, 10:06
ASIO SDK: http://www.steinberg.de/329+M52087573ab0.html

There are a few implementation out there already however.

As I said, I don't know how you are playing back music at the moment, but if bit-perfect playback isn't possible at the moment I might have time at a later stage to look at a bit-perfect implementation in Windows XBMC myself, Team-XBMC allowing.

WiSo
2008-04-07, 10:15
feel free. A good starting point is Win32DirectSound.cpp.

jmarshall
2008-04-07, 10:24
I believe Wiso's recent work has allowed XBMC for win32 to output "bit-perfect" (i.e. pass-through'd) compressed streams such as AC3 and DTS assuming they're 48kHz - I'm not sure whether it works with 44.1kHz, and ofcourse it'd depend on the sound card.

All other audio is upsampled using SSRC to 48kHz, which is likely the best way to go for many chipsets (such as those that only allow 48kHz output). Whether or not it still passes through the windows mixer I have no idea, but I presume it does - we use standard directsound for the output.

Any patches to this will ofcourse be considered.

Cheers,
Jonathan

phunqe
2008-04-07, 12:55
Thank you both, I'll direct any possible future questions on this to the Windows dev forum section.

injeee
2008-10-23, 17:58
Hi folks,

Any news around this thread? Friend of mine is using MediaPortal for music playback, since it supports ASIO / Kernel Mode.. and he asked me if XBMC could do the same..

Will it be possible sometime?

Thanks!

spiff
2008-10-23, 18:23
sure. it's just a matter of you coding it and submitting the patch.

injeee
2008-10-24, 00:05
spiff, I'd do that for sure if I had the coding skills.. but if i tried to do such thing.. i really don't think you would accept the "patch" ;-)

Really.. I just came over this thread.. just reminded me about the dude who was wondering. :-)

But it'd be a very nice feature to add later on tho.. wouldn't it? :)

abit_late
2008-10-28, 12:00
I would love to see the option and ability to use asio! The difference in sound quality with bit perfect playback is significantly better and annoyingly means I am having to stick with winamp.

BladeNight18
2008-11-09, 07:58
Yeah, there needs to be foobar integration in XBMC

bb10
2008-11-09, 15:51
WASAPI exclusive mode could be used on vista to achieve this.

dmidi
2009-01-22, 20:50
WASAPI exclusive mode could be used on vista to achieve this.

Second that...WASAPI also allows all other window sounds to be muted which would definitely be appropriate for a Home Theater front end.

ASIO, WASAPI, kernel streaming implementation would all be ways by which XBMC could gain some time to create their own decoding/playback systems which allow for tighter control of the audio system.

Any of these efforts could be undertaken with the thought of enabling single source, multizone playback - for example, using the front headphone outputs for zone 2 while zone 1 is output through the analogue surround outs.

dmidi
2009-03-24, 01:48
The general question of xbmc music/movie audio quality is being addressed by usage of the libsamplerate library (secret rabbit code SRC). SRC is used in Foobar and is great when combined with KS or any of the other methods to bypass windoze mixer.

If I recall correctly, SRC at it's highest quality now has an SNR of 143 db compared to Windows mixer 92 db! In my experience, that level of quality comes at about 20% CPU core utilization on Core 2 architecture.

This code could be taken further in XBMC and used to eliminate the resampling concerns (which was the original purpose for SRc).
XBMC Smooth Video (and smooth audio) forum (http://xbmc.org/forum/showpost.php?p=301890&postcount=86)