Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: MF V-DACII clipping in XBMC 13.1 (Read 3694 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

MF V-DACII clipping in XBMC 13.1

Hello

I have a strange problem I can't figure out the cause and a solution. I hope the experts here could help me.

Hardware I'm using is a self build HTPC (i3, SSD) using Windows 8.1 and a Musical Fidelity V-DAC II using a high quality AudioQuest USB cable. The rest of the hardware doesn't really matter.

I have serious problems using the USB connection with the DAC. (Tried different cables just to be sure).

What happens:
Normal music using WASAPI gives no problem at all (FLAC)
When playing video, including multichannel audio via WASAPI the V-DAC starts making very loud clipping popping sounds (English is not my primary language, I hope you understand) which could easily harm my tweeters when playing loud. It pops only at the peaks.

When viewing Youtube clips via XBMC's youtube plugin I get the same clipping. Even worse because Youtube clips are very loud most of the time.

I prefer to use the USB though because I like to keep de TOSLINK connector available to other devices.

Reinstalling Windows and all software doesn't fix it.

When using directsound there is no problem at all. Toslink via WASAPI or directsound, not a problem.
It's definitely clipping, 100% sure not a buffering problem, when I turn up the amplification up a little in XBMC the crackling gets extreme...
Also not a video problem, when playing a very quiet classical video track it doesn't clip. Also lowering the volume via audio-settings in XBMC solves it but I would like bit-perfect playback and lowering the output by -0.6dB is not the right fix for me. Another strange thing. If I lower the volume by -0.6db the crackling stops and even when I put the Volume Amplification to +60dB (sixty!) there is no crackling (only smashed down dynamics). That makes me think the problem is hitting 0dB is causing digital clipping... My bet is at XBMC having problems with digital clipping... Would like a solution though

Please help! I would really love to use USB + WASAPI + XBMC.

PS. In older versions of XBMC <12 I don't remember to have had such problems....

MF V-DACII clipping in XBMC 13.1

Reply #1
Quote
Normal music using WASAPI gives no problem at all (FLAC)
When playing video, including multichannel audio via WASAPI the V-DAC starts making very loud clipping popping sounds (English is not my primary language, I hope you understand) which could easily harm my tweeters when playing loud. It pops only at the peaks...

...When using directsound there is no problem at all.

Toslink via WASAPI or directsound, not a problem.
That sounds like a driver problem.  The DirectSound drivers are working, but the WASAPI drivers are not.  Or, maybe it's XBMC.  (I didn't see anything on the Music Fidelity website about drivers or WASAPI compatibility.)

That appears to be a stereo DAC so the surround sound has to be mixed-down.  Mixing is done by addition and if you don't scale-down the levels you can get clipping.    All applications/drivers SHOULD handle the mix-down properly without clipping. 

Quote
...but I would like bit-perfect playback
That is a 2-channel stereo DAC, right?  How can you go from 6 channels to 2 without altering the bits? 

Quote
If I lower the volume by -0.6db
That's odd too.  Normally, 0.6dB of clipping wouldn't be audible.  Even with 6dB of clipping, you'd probably hear some distortion but not "popping".  It ALMOST sounds like you've got "rollover"...  That's similar to what happens if you have a counter that goes to 999 and if you count to 1000, it rolls-over and starts-over at zero.  That should NEVER happen if the programmer knows what they are doing, but if it does the distortion is far worse than normal clipping.


Quote
using a high quality AudioQuest USB cable. The rest of the hardware doesn't really matter.

I have serious problems using the USB connection with the DAC. (Tried different cables just to be sure).
Strange!  I don't think I've EVER had a bad USB cable!

MF V-DACII clipping in XBMC 13.1

Reply #2
I found that, on Vista anyway, DSound and other non-exclusive mode output APIs gave levels 3 dB lower than WASAPI exclusive. Which would explain why you didn't encounter any clipping there.

Mind doing a little test?
Get a current nightly build of Audacity. Set it up to use WDM-KS output. (WASAPI output seems to be in shared mode.)
Use the Tone Generator to generate a 440 Hz sine of amplitude 0.999.
Play this over your DAC. Does it clip?

Assuming this passes with no issues, you'd need to take a closer look at the XBMC playback chain. Since there seems to be a compressor in it, it's probably a bit more complex than one might be inclined to think.

BTW, bit-perfect output is overrated. You only truly need it for AC3/DTS passthrough, otherwise it's quite sufficient if there aren't any nasty things happening. A bit of digital attenuation at float32 accuracy with 24-bit output really is nothing to worry about.

EDIT: DVDdoug has a good point re: surround sound vs. stereo output. Then again, your average Youtube vid is plain 2.0, so there has to be more to it.

MF V-DACII clipping in XBMC 13.1

Reply #3
Of course the downmix is not bitperfect you're absolutely right about that. Bitperfect is also a very wrong word of choice from me. I just want the least amount of processing. I do not trust directsound with this. Especially with FLAC I want the PC to send 44.1kHz so the DAC can do it's thing. When using DirectSound it is processed to 96kHz and then again the DAC also processes it to 192kHz, changing directsound to 44.1kHz is possible, but then 48kHz and upper signals are processed again, because it stays at 44.1kHz, windows wants to 'mix' every sound source so it uses a fixed sampling rate.

I do not want to start a discussion whether this is audible, I just want the least processing possible. Also when using Directsound I risk that other programs influence the audio output by mixing in their 'system sounds' etc.

The ROLLOVER mentioned. That is exactly what I was thinking too, but could not find the right words for it. The moment it start clipping the pops are incredibly loud. That is exactly what you mention. It looks more like it swaps from +32767 to -32768 and back creating very loud crackling.

Driverproblem: I don't think so. The USB Dac works natively in Windows 7/8. I think also that older versions of XBMC (with the old audio engine) did not have this problem, but I am not 100% sure.

The test mentioned I can try that, but I'm at work at the moment

As a last resort I could make use of an TOSLINK to COAX converter, but I absolutely would like to avoid that route.

MF V-DACII clipping in XBMC 13.1

Reply #4
Quote
It looks more like it swaps from +32767 to -32768 and back creating very loud crackling.
You're right!  That happens because binary signed integers are stored in two's complement.

Although, it would still sound horrible if it was "only" rolling-over to zero.     

So it would seem there are two bugs in the software - Downmixing is not done properly and it's causing clipping.  And, clipping is not handled properly. 


--------------------
The most significant bit is the sign bit.  A one followed by 15 zeros is -32,768 when converted to decimal.    With two's complement there is no such value as negative zero, and you can count one bit higher with negative numbers than you can with positive numbers.

I've written "dumb" programs that count in an infinite loop with 16-bit signed integers.  After the count hits 32,767, the next count is -32,768 and from there it counts down* to zero where it starts-over. 

If you look at the underlying binary numbers, they are always counting up until they roll-over to zero, ignoring the fact that the MSB is going to be treated as the sign bit when the numbers are converted to a signed decimal value and displayed on the screen.




* Technically, we've jumped to a big negative number and we are counting-up to zero.  But, the numbers (absolute values) are getting smaller.

MF V-DACII clipping in XBMC 13.1

Reply #5
I understand completely, although I don't know where it's going wrong. If it is XBMC, then there should be the same problem when using TOSLINK.

As far as I know it is not a known bug in XBMC, but in older versions I cannot recall to have had these problems.

Hmmmz.... 

MF V-DACII clipping in XBMC 13.1

Reply #6
I wonder if this is a driver (WASAPI) problem.
It does what it does, handle the bits unaltered to the DAC.
If upstream something is done wrong, it will handle the wrong bits.
Likewise if the media player doesn’t interface right with WASAPI, you have all kind of problems.

Your best bet is probably trying another media player supporting both audio and video and WASAPI exclusive mode like JRiver
TheWellTemperedComputer.com

MF V-DACII clipping in XBMC 13.1

Reply #7
I think I found a workaround....

I had the option "Normalize levels on downmix" turned off. I turned this option on, the music plays fine now! the stereo track on the BD is a lot louder though, but the problem is gone.

Seems that the normalizing process in XBMC clips the sound, even in XBMC 13.2 beta 1

MF V-DACII clipping in XBMC 13.1

Reply #8
A complication arises again.

Now I have a BD disk that has 5 different audio tracks. The AC3 5.1 downmixes fine, but there is also a 'just' 5.1 track. That triggers the crackling noise again.

For the safety of my setup i think I have to resort to TOSLINK again....

The 'non ac3' 5.1 track is played a lot louder by the way. Something is really wrong in the xbmc downmixing routing I think. Looks like the downmix samples are added up, but are not divided by the amount of channels...