(2017-11-22, 17:35)erqiyang Wrote: (2017-11-21, 08:23)wirerydr Wrote: (2017-11-20, 09:14)erqiyang Wrote: Hi, Thanks for your guide. It's easy to follow and will most of the time get things to work.
I've recently re-installed my entire box again (for various reasons), and installed Fedora 26 server with Kodi 17.5 from the rpmfusion repo.
My box is connected to the TV through hdmi, and I have a cec box in between from eight-pulse.
The problem now is, the audio does not play when I select the output to the TV.
I installed the alsa-utils and ran a speaker-test command, and I can get the sound from the TV, so the set-up must be correct. (Additionally, this was a working set-up before my hands got itchy... )
Itchy hands definitely help to keep life interesting. Without debug logs, system logs, etc. however, the best I can probably offer are a few suggestions, in decreasing order of likelihood:
- Double-check in Kodi that you're using the correct Alsa card/device. In my case, under Settings -> System -> Audio -> Audio Output Device I have 4 devices listed (all from the same HDMI card), and the 2nd one is what works for me. Kodi will probably default to using the 1st enumerated device unless you specify otherwise, and that might not be right for you.
- Make sure you don't have Kodi muted / volume'ed down. I haven't seen it often recently, but upon occasion I've discovered that a fresh install of Kodi will have no volume until I manually increase it and/or enable passthrough (which I always do after fresh installs since I'm using an A/V receiver that can decode all of the most common formats).
- Ensure that you've added whatever user you're running Kodi as to the audio group as indicated in the wiki.
- Double-check that Alsa itself isn't muted, at least on the specific channel you need. alsamixer is one tool you can use to control this.
- I think you mentioned connecting your Kodi box to a TV with a CEC box in the middle. Presumably there is no A/V receiver involved. In this case double-check that you're not trying to test with an audio format that your TV cannot support. E.g. with passthrough enabled, playing media with a DTS-HD or Dolby TrueHD audio track when your TV can only accept PCM.
- Try testing your setup without the CEC box. I doubt this is actually the problem, but it's worth ruling out.
Failing that, take a look at your kodi logs ( found in $HOME/.kodi/temp ) and see if any audio-related errors / weirdness show up. I'd suggest first doing this right after powering up Kodi, and if that looks good then again after attempting to play some media. If you're willing to wade through more data then do this with debugging enabled.
Sorry I can't be more help off the top of my head. Best of luck, and let us know how this turns out for you!
Thanks. I've actually gone through step 1 - 5 that you mentioned. Literally nothing works. I can try step 6 again over this weekend maybe, but like you mentioned, I highly doubt it's a problem.
I've also stopped Kodi and ran speaker-test independently from the CLI, and it can send sound to the TV. Additionally, I've scoured through all the debug logs in $HOME/.kodi/temp, and there's no error related to sound at all. I've also gone as far as to look at the linux log, and there's absolutely no error. (I can probably try to post the logs again this weekend if I haven't solve it by then).
It seems to me that the sound signal is being blackholed somewhere. :-(
You can rest assured that if I ever find the solution, I'll definitely post it here for my future reference as well.
Ok. I've gotten it to work. And I think it's also a mistake on my part. What happened was I had copied the
$HOME/.kodi directory as a back-up from the old to the new installation, thinking that it should work. However, I forgotten that I was actually using pulseaudio from the old set-up. So when I got it booted up the first time, I couldn't hear any sound from the TV (I was actually only testing the GUI Sound at this point).
In the old set-up, my sound was to 5.1, but it will not work in ALSA, since my TV only takes in 2 channel. Since the GUI Sound doesn't generate any log at all, I really couldn't see what's happening. So I tried to generate some log to show you by playing some video (hoping some error message will show up). To be honest, a bunch of logs, but no error on them as well. But hey, the audio playback was through the TV this time round. Still, the GUI Sound is not playing at all, and it's kind of irritating for me because I'm very used to them.
In desperation, I actually navigated to the folder where the GUI sound wave file was located (
/usr/share/kodi/addons/resource.uisounds.kodi/resources/) to manually play them through kodi. None of the file could play through kodi at all. I ran the file through the speaker-test command (
speaker-test -c 2 -D hw:0,8 -r 44100 -t wav -w /usr/share/kodi/addons/resource.uisounds.kodi/resources/back.wav) and got a bunch of error rejecting the wave files due to channel count and/or sample rate etc.
Eventually, I looked up the old configuration (that I had backed-up), and under the guisettings.xml, I found the holy grail. (
<audiodevice>PULSE:alsa_output.hw_0_8</audiodevice>). I was using PulseAudio all along. *facepalm*
Interestingly, even with PulseAudio installed and running, it wasn't giving output to the TV speaker, so I added a file at
$HOME/.asoundrc with the following config:
defaults.pcm.!card 0
defaults.ctl.!card 0
defaults.pcm.!device 8
defaults.ctl.!device 8
That makes the audio device as the default pulse audio device for output. And solves everything.
tldr?
1.
Install PulseAudio :
sudo dnf -y install pulseaudio alsa-utils
alsa-utils is needed for some tools used in subsequent step
2.
Identify output device :
aplay -l
That gives an output similar to this:
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC233 Analog [ALC233 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
In my system, there's a couple of device. If you know which device you are using, good. Otherwise, you can run through each of them with speaker-test and see what works. In my case :
sudo systemctl stop kodi
speaker-test -D hw:0,3
speaker-test -D hw:0,7
speaker-test -D hw:0,8
speaker-test -D hw:0,9
speaker-test -D hw:0,10
You need to stop kodi first so it frees up the device for testing.
3.
Configure default device :
Create a file at location
/home/.kodi/.asoundrc with the following input:
defaults.pcm.!card 0
defaults.ctl.!card 0
defaults.pcm.!device 8
defaults.ctl.!device 8
Change the device and card accordingly.
4.
Reboot the box
The above step works for me, so its here in case anyone else needs them too.