Kodi Community Forum

Full Version: ATV: Sound crackling at start/end (but mostly end) of movie
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is probably for the devs.

I have a minimum Kodi standalone - Ubuntu 14.04 setup on my old (but still not dead) ATV. I'm running Isengard 15.1 final.
The HDMI sound configuration on this one is slightly different compared to the norm. The internal Realtek soundcard feeds the HDMI device, instead of the GPU having it's own soundcard.

I use this .asoundrc

pcm.!default {
type plug;
slave.pcm "plughw:0,3";
}

This gives me 2 advantages: Kodi will default to HDMI sound on first run instad of analog output (no big deal), and it gives me sound through HDMI when running other programs,such as Retroarch (big deal).

While this works just fine, I think there is a bug in Kodi somewhere. With this .asoundrc in place, whenever starting/stopping a movie, it will give a crackle, whereas the crackle when stopping the movie is particularly bad. Without this file (or if I comment out the lines) there is no crackling. The most logical thing would be that Kodi should just ignore .asoundrc after the first-run and/or after it has started. It should not influence the starting/stopping of movies.

I am comfortable with building from source if anybody comes up with a fix and wants it verified.
Edit:I'll add that it's only happening on one of my TV's (1 out of 2). And the "end" in the topic means "stop".
Fritsch: Any comment on this?

http://pastebin.com/TTyaiVEt
(2015-08-28, 16:05)Soli Wrote: [ -> ]Fritsch: Any comment on this?

http://pastebin.com/TTyaiVEt
Pastebin is blocked in turkey where I am currently. Same after speaker-test -c2 ?
speaker-test -c2 played fine, no crackling. ran it forever and ctrl-c didn't produce any crackling whatsoever.

Same debug log:
http://pasted.co/577e46ad
When you press stop, we skip 38 packages. System overloaded?

Try fixed 2.0 48 kHz + keep audio Alice always.
Fritsch, as I wrote earlier. It works perfectly fine when I don't have an .asoundrc file, but I need that file to use Retroarch or other programs or I won't get sound through HDMI.
It does work fine with fixed 48/88/96/192khz and off/always/1min, so not a big problem, but still.
Try hw:0,3 instead.
same Smile
No idea, then. Kodi enumerates devices by self. If selecting the real devices in kodi instead of the default does not help, no idea.
OK, I wont get suicidal over this. Thanks for your time anywaysSmile

edit: maybe part of the problem is that my TV accepts various rates up to 192khz including AC3. My other TV support only 44/48 and no AC3.
Hello again:
I wonder if this might be part of the problem:

These are the same device. If there is no .asoundrc then there will be no default device. I've tried with plughw,hw, and hdmi and they all show this:

NOTICE: Device 1
NOTICE: m_deviceName : default
NOTICE: m_displayName : Default (HDA Intel HDMI 0)
NOTICE: m_displayNameExtra:
NOTICE: m_deviceType : AE_DEVTYPE_PCM
NOTICE: m_channels : FL,FR,BL,BR,FC,LFE,SL,SR
NOTICE: m_sampleRates : 32000,44100,48000,88200,96000,176400,192000
NOTICE: m_dataFormats : AE_FMT_S32NE,AE_FMT_S16NE,AE_FMT_S16LE

NOTICE: Device 4
NOTICE: m_deviceName : hdmi:CARD=Intel,DEV=0
NOTICE: m_displayName : HDA Intel
NOTICE: m_displayNameExtra: HDMI
NOTICE: m_deviceType : AE_DEVTYPE_HDMI
NOTICE: m_channels : FL,FR,BL,BR,FC,LFE,SL,SR
NOTICE: m_sampleRates : 32000,44100,48000,88200,96000,176400,192000
NOTICE: m_dataFormats : AE_FMT_S32NE,AE_FMT_S16NE,AE_FMT_S16LE,AE_FMT_LPCM,AE_FMT_DTSHD,AE_FMT_TRUEHD,AE_FMT_EAC3,AE_FMT_DTS,AE_FMT_AC3,AE_FMT_AAC

I've also added:
<audiooutput>
<dtshdpassthrough>false</dtshdpassthrough>
<passthroughaac>false</passthroughaac>
<truehdpassthrough>false</truehdpassthrough>
</audiooutput>

It seems the devicetype and supported dataformats get enumerated differently even though it's the same device. Is this part of the problem? And to recap: I don't get crackles when I don't have an .asoundrc and if the TV only supports 44/48khz. (This TV is obviously a little special since it supports all the rates up to 192khz incl AC3)
.asoundrc changes how alsa devices are enumerated ... adds devices, changes devices.

Last thing you can try, don't use a plug, but hw instead, see: https://wiki.archlinux.de/title/Alsa

This has nothing to do with kodi ...
Thanks Fritsch. You already said that earlier. The same happens with hw. Was just my last ditch effort to get to the bottom of this, but if you say it hasn't got anything to do with Kodi, then I'll take your word for it.