Kodi Community Forum

Full Version: Gotham - pops and crackles with WASAPI
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Hi all,

I'm using a USB DAC in WASAPI mode for sound. The volume is kept at 100%, exclusive mode is enabled and enhancements are disabled in the Control panel.

In Frodo, everything works fine. However, after I upgraded to Gotham, I find that sound in some YouTube videos pop and crackle (both when streaming from youtube and when playing a downloaded file). One example is Five Little Monkeys (a nursery rhyme for the little one Smile

Using DS mode works fine. Also, using the built-in sound card on my laptop in WASAPI mode works fine.

Here's a verbose debug log from 13.2 beta 2, with verbose logging of the audio system. The audio device used is M2Tech hiFace DAC UAC2: xbmc.log

Thank you
There is an issue with this exotic format AE_FMT_S24NE3. I will have a look into this after my vacation.
Until Fernetmenta has the time to take a look, could you see if turning the XBMC volume control down has any effect, may only need a couple of notches.
@jjd-uk: I think I've tried that and it didn't make any difference. I'll try again when I have a bit of time and energy in the evening Smile

@FernetMenta: Does that problem mean that there is some sound processing done even in WASAPI event mode with 100% volume, or is it just a bug in decoding the format? I'm asking because I'm generally interested in bit-perfect output from lossless formats to my DAC and there is a lot of contention in the user community which media player actually does bit-perfect sound output and which one sounds better. I've even seen threads where people claim that some songs sound better on a player X and others on a player Y Smile

Thank you
There is no sound processing but there are format conversions. No worries, you still get bit-perfect output because the internal formats use more than 24 bits and you can do as many conversions as you want between those two without any loss of data.
@bozho I found some time before my vacation starts. Could you try this Helix test build? http://mirrors.xbmc.org/test-builds/win3...wasapi.exe

save your xbmc home folder prior to testing this.
Sure, I hope I'll be able to test is later this evening... Thank you!
Hi,

This build really breaks things Smile I've upgraded from 12.3 directly. On XBMC startup, I get very loud noise. Switching to DS kills the noise, switching back to WASAPI brings back the noise. Here's the log with startup only: XBMC startup

I tried playing the video then and it's just noise with a bit of sound coming through. Decreasing the volume doesn't have any effect. Here's the log: play video
Sorry, bear with me. This is the first time in almost 2 years I have seen this silly format of AE_FMT_S24NE3. Those guys who wrote this driver have absolutely no clue about computer science. A 3 byte alignment is completely stupid at the the application level. XBMC is multi platform and we can't simply cast a character pointer to integer like it was done in Frodo.

I still want to fix this. I hope those guys at M2Tech have more knowledge about DAC than they know about computers.
No worries, I'm happy to help with testing. Are you sure it's the DAC driver issue, since other stuff plays just fine: other YouTube videos (I did find a few more that crackle), FLACs, etc...

Here's a log of me playing two FLACs. The first one is 96kHz/24b, the other one is a regular CD rip. Both play fine at 100% volume.

I tried jjd's suggestion and turned the volume down one notch for the sample video and the noise was gone.

M2Tech guys must have had their reasons - I can't fathom the reason for 3-byte alignment, but hiFace DAC is currently considered by many one of the best price/performance DACs Smile Can you try asking them? They seem like a small company and I had a pleasant email exchange with them when buying my DAC... This is their site: m2tech
Ok, I tried upgrading DAC's firmware, no dice.

It is also possible to select DAC's output stream format. The default is 2ch/24b, which causes the problem. I switched to 2ch/16b and the sample video's audio is fine. Here's the log
Sure but 16 bit is not what you want, right? I thnk I have mixed up little/big endian paths. Here is a new test build: http://mirrors.xbmc.org/test-builds/win3...wasapi.exe
Hi,

Yeah, I'd like to use 24 bit, I just wanted to test it. Obviously, with 16 bits, frame size per channel is 2 bytes, so I was expecting it to work...

Regarding your comment that you can't just cast a char* to an integer... I may be talking out of my ass, since I don't have any experience in audio-related development and don't know anything about XBMC code, but if the audio is a stream of bytes and you advance a char* along the stream to read frames, couldn't you do something like:

Code:
char* currentPos = audioStream;
int mask = 0xFFFFFF00; // the actual mask value would depend on endianess, frame size and int size

while(currentPos != endOfStream) {
    int frame = (int)currentPos & mask;
    // do stuff...
    currentPos += frameSize;
}


I've downloaded the new build, but I may not have the time to test it before Friday night...
The problem is alignment. Depending on the platform and compiler switches an integer may not be able to start at every address. In case of a 4-byte alignment it can only start every 4 bytes. Incrementing an uint8_t pointer by 3 and cast it to integer would result in something undefined. You need to copy byte by byte. Putting together a S24NE3 stream is just a waste of resources.
Ah, I see, didn't have to think about word alignments in years :-) I might ask the guys at M2Tech why they did it, I'm curious now.

I still don't understand why does the sound crackle only on those videos and not while playing FLACs (both 16 and 24 bit ones) (sorry for bothering you with questions Smile
Pages: 1 2 3 4