Bit perfect 2ch audio from FLAC?
#1
Hi guys.

I'm in the process of setting up a stereo/home theatre system for a small apartment. What I want is to set up an all-in-one system that makes the most of the small space that I have.

With this in mind, I'm setting up a HTPC to send its audio through a DAC to a stereo amplifier. I don't mind not having surround sound (not enough space for that), and I don't mind if the sound of my DVDs and avi/mkv/etc files isn't COMPLETELY perfect, as long as I can get bit perfect audio from the flac files I rip from my CDs.

Although XBMC is limited to 16 bit audio for now, I think this is irrelevant to me for the most part because although multi-channel Blu Ray and DVD rips would be processed by the software due to being higher than 16 bit, they would need to be processed anyway to downmix the audio from 5.1 or 7.1 to 2.0 for the DAC to understand it.

So what I'm wondering is, has anyone managed to set up bit perfect audio (i.e. comparable in sound quality to, say, Foobar2000 run through WASAPI) in XBMC for 16-bit, 44.1 kHz flac files?

I have tried using Foobar as an external player for flac, but this didn't work too well and it kind of ruins the flow of the XBMC interface to have another program opening on top of XBMC which is then difficult to close, etc.
Reply
#2
I use XBMC mostly for audio, and I have a midrange system: Marantz CD-63KI CD and 6010KI amp with Heybrook HB2 speakers (if you've never heard of the HB2 that's probably because they are older than most XBMC users :-).

I use a Mac Mini, on the grounds it has the best audio circuitry of any HTPC I've tried, and just run the audio out into my amp. If I rip a CD to wavs and do a head to head comparison with my CD player then it's hard to tell the difference. I can sort of convince myself that the CD is better, but I'm not confident I could tell which was playing in a blind test. If I use 256Kbps mp3s, or my (much cheaper) Acer Revo, then I can tell the difference.

On my list of things to do one day is to get one of these, http://www.lindy.co.uk/spdif-digital-to-...70408.html, and test it with the optical out on my Revo. However since the sound from my Mac Mini is already very good it's not top of my list.

JR
Reply
#3
Gentle bump
Reply
#4
Maybe you need to explain what you mean by "bit perfect audio". Playback from FLACs is bit perfect by definition, right up to the point where it hits whatever D-A convertor you use. The audio quality is controlled by your DAC not XBMC. That's why I mentioned the Lindy DAC, as it's cheap and has good reviews. If you want really really good quality you can spend several thousand pounds on a DAC, but as I mentioned above, the one built into a Mac Mini is actually pretty good.

JR
Reply
#5
JR is correct - your 16/44.1 FLACs are being played bitperfect. You can use WASAPI as an output method and no mixing or resampling will take place.

Foobar accepts a /nogui command-line switch if that is your preferred route.
System: XBMC HTPC with HDMI WASAPI & AudioEngine - Denon  AVR-3808CI  - Denon DVD-5900 Universal Player  - Denon DCM-27 CD-Changer
- Sony BDP-S580 Blu-Ray  - X-Box 360  - Android tablet wireless remote - 7.1 Streem/Axiom/Velodyne Surround System
If I have been able to help feel free to add to my reputation +/- below - thanks!
Reply
#6
jhsrennie Wrote:Maybe you need to explain what you mean by "bit perfect audio". Playback from FLACs is bit perfect by definition, right up to the point where it hits whatever D-A convertor you use.
Not necessarily. It may be resampled to 48khz or pass through some mixing before going to an external DAC.

From what I've read on other forums, XBMC doesn't quite match up to, say, kernel streaming in Foobar. Apparently it sounds very slightly veiled and compressed. I am not exactly sure why.

jhsrennie Wrote:If you want really really good quality you can spend several thousand pounds on a DAC
I already did. Well, not thousands, but hundreds, and I want to get the best sound out music in my system as is possible.
Reply
#7
Cath Barkley Wrote:Not necessarily. It may be resampled to 48khz or pass through some mixing before going to an external DAC.

From what I've read on other forums, XBMC doesn't quite match up to, say, kernel streaming in Foobar. Apparently it sounds very slightly veiled and compressed. I am not exactly sure why.


I already did. Well, not thousands, but hundreds, and I want to get the best sound out music in my system as is possible.

Cath, there is no doctoring of the FLAC data at 16-bit in XBMC. It uses the standard libFlac library and delivers bit-perfect data to your chosen Windows output layer. You can force re-sampling within XBMC or by using DirectSound, but by going with Wasapi you are getting bit-perfect copies of your FLACs to your DAC.

There is nothing done to veil or alter the data, and bit-for-bit the data will arrive at your DAC exactly as it would from Foobar. If you read the Foobar FAQ they note that Foobar does not sound any better than any other bit-perfect player - it can't when purely streaming the data.

If it comes to 24-bit, yes, Foobar does currently handle that, and mainline XBMC does not. That said, the AE branch does, and you may notice improvement on 24-bit FLAC using that branch.

I'm very familiar with the various players out there, like Foobar, WinAmp and J River, and assure you that when setup correctly there is no difference whatsoever in their output - it is exactly the same as the input in each case.

Relax and enjoy the music!
System: XBMC HTPC with HDMI WASAPI & AudioEngine - Denon  AVR-3808CI  - Denon DVD-5900 Universal Player  - Denon DCM-27 CD-Changer
- Sony BDP-S580 Blu-Ray  - X-Box 360  - Android tablet wireless remote - 7.1 Streem/Axiom/Velodyne Surround System
If I have been able to help feel free to add to my reputation +/- below - thanks!
Reply
#8
OK I believe you. What about in Linux?
Reply
#9
Cath Barkley Wrote:OK I believe you. What about in Linux?

To be honest that's not my development platform so I won't give you a definitive answer on that one. From XBMC's output the answer is yes, but I'm not familiar enough with PulseAudio or ALSA to say for certain, as I can with WASAPI. I can't say with certainty what happens in Linux once it leaves XBMC.

ALSA is, if I recall, capable of bitperfect. Perhaps a Linux dev or advanced user can pipe in here.
System: XBMC HTPC with HDMI WASAPI & AudioEngine - Denon  AVR-3808CI  - Denon DVD-5900 Universal Player  - Denon DCM-27 CD-Changer
- Sony BDP-S580 Blu-Ray  - X-Box 360  - Android tablet wireless remote - 7.1 Streem/Axiom/Velodyne Surround System
If I have been able to help feel free to add to my reputation +/- below - thanks!
Reply
#10
DDDamian Wrote:If it comes to 24-bit, yes, Foobar does currently handle that, and mainline XBMC does not.
Are you sure about that? Even when using WASAPI?
For troubleshooting and bug reporting please make sure you read this first (usually it's enough to follow instructions in the second post).
Reply
#11
ashlar Wrote:Are you sure about that? Even when using WASAPI?

Quite sure - atm FLACs are played back at 16bit. For 24bit I use the AE branch or Foobar. Without going into the code details:

From MediaInfo:
Audio Format : FLAC
Format/Info : Free Lossless Audio Codec
Duration : 3mn 36s
Bit rate mode : Variable
Bit rate : 2 812 Kbps
Channel(s) : 2 channels
Sampling rate : 96.0 KHz
Bit depth : 24 bits
Replay gain : -5.09 dB
Replay gain peak : 0.966057
Stream size : 72.7 MiB (100%)
Writing library : libFLAC 1.2.1 (UTC 2007-09-17)

From debug log:
15:45:34 T:6784 DEBUG: CWin32WASAPI::Initialize - Channels: 2 - SampleRate: 96000 - SampleBit: 16 - Resample false - IsMusic true - IsPassthrough 0 - audioDevice: AMD HDMI Output (AMD High Definition Audio Device)

This is in Wasapi Exclusive mode. It's one of the reasons the audio code is being redone.
System: XBMC HTPC with HDMI WASAPI & AudioEngine - Denon  AVR-3808CI  - Denon DVD-5900 Universal Player  - Denon DCM-27 CD-Changer
- Sony BDP-S580 Blu-Ray  - X-Box 360  - Android tablet wireless remote - 7.1 Streem/Axiom/Velodyne Surround System
If I have been able to help feel free to add to my reputation +/- below - thanks!
Reply
#12
(2012-03-01, 08:02)DDDamian Wrote:
Cath Barkley Wrote:OK I believe you. What about in Linux?
ALSA is, if I recall, capable of bitperfect. Perhaps a Linux dev or advanced user can pipe in here.

You're right, ALSA is capable of playing unmodified audio and pulseaudio is not. To check what your Linux sound stack actually does and what formats/bit depths and sample rates your DAC supports, check my article What digital audio format does your USB DA-converter support and use?.

Besides background information on the matter, it refers to the script alsa-capabilities which lists each sound card or external USB DAC connected to your xbmc PC and its capabilities, hardware address and name and path of the pseudo file which you may use to see what the DAC/sound card is actually doing.

With those parameters known and when you have a (non resampling) external USB DAC connected to your xbmc host, you could use that in your xbmc audio configuration. Next, open a terminal on the xbmc host and watch the correct pseudo stream file.

For example, when the scripts shows you the following parameters:
Code:
hardware address: hw:1,0
stream file: /proc/asound/card1/stream0

You may use the following commands to check the output:

Code:
root@desktop:~# ssh xbmchost
root@xbmchost:~# watch -n 1 "cat /proc/asound/card1/stream0"

Then in xbmc, start playing a 16bit/44.1KHz audio file and look in the terminal. The first two lines under `Playback: Status: Running` should indicate that the `Altset x` is active which has `Format: S16_LE` and `Momentary freq = 44100 Hz` .

Then switch to playing a 24bit/96KHz file and you should see the `Altset` changing to the one supporting `S24_3LE` and a `Momentary freq = 96000 Hz` .

If you need a dedicated hassle free bit perfect audio streamer based on Linux check my article urn Linux and Music Player Daemon (mpd) into an audiophile music player.

Regards,
Ronald
Reply

Logout Mark Read Team Forum Stats Members Help
Bit perfect 2ch audio from FLAC?0