Recalbox 7.0

No HDMI audio from MSI Cubi 2



  • Hi all,

    I set up the latest recalbox on an MSI Cubi 2 (Intel Kaby Lake Core i3-7100U). I'm booting from an SDD that I copied from the USB thumb drive that I originally installed Recalbox on. Most of the the set up I did in the middle of this year.

    Everything seemed to work fine when attached to a monitor and using headphones. But when I tried connecting it to a TV via HDMI I can't get audio to work.

    Based on a bunch of searches I've tried listing the audio hardware and playing a known wav file through each HDMI device. I get no sound. I tried multiple HDMI cables just in case.

    For completeness sake, here's my list of audio devices:

    aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog]
    Subdevices: 0/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: 1/1
    Subdevice #0: subdevice #0

    To test the audio interfaces I did this command line with hw:0,3 hw:0,7 and hw:0,8 successively:

    aplay -vv ~/test/piano2.wav -D hw:0,3

    When I run the above, I see errors like the following in /var/log/messages:

    Dec 29 01:14:16 RECALBOX user.info kernel: [ 1523.052287] snd_hda_codec_hdmi hdaudioC0D2: HDMI: audio coding type 0 not expected

    Note that while doing the above experiments I left recalbox and alsamixer pointed at the default audio output. The result is that hw:0,0 is busy when I try to play the wav file from the command line (as expected, I suppose).

    When I redirect recalbox at the first HDMI 0,3 then I can play the the wav file from the command line on hw:0,0. But even with headphones plugged in I hear nothing. I would have expected to be able to hear the wav file through headphones using the Analog output.

    Headphone sound was definitely working at some point earlier. I did at least one update since setting up the machine in the middle of the year. Maybe an update killed it?

    Anyway, I'm at my wits end. Hopefully someone can help.

    Thanks in advance.



  • Well I'm a little closer. When I do this list I can see that there are multiple HDMI outputs, both surround sound and non-surround sound:

    aplay -L
    null
    Discard all samples (playback) or generate zero samples (capture)
    default:CARD=PCH
    HDA Intel PCH, ALC887-VD Analog
    Default Audio Device
    sysdefault:CARD=PCH
    HDA Intel PCH, ALC887-VD Analog
    Default Audio Device
    front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    Front speakers
    surround21:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    2.1 Surround output to Front and Subwoofer speakers
    surround40:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    4.0 Surround output to Front and Rear speakers
    surround41:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
    surround50:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    5.0 Surround output to Front, Center and Rear speakers
    surround51:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
    surround71:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887-VD Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
    hdmi:CARD=PCH,DEV=0
    HDA Intel PCH, HDMI 0
    HDMI Audio Output
    hdmi:CARD=PCH,DEV=1
    HDA Intel PCH, HDMI 1
    HDMI Audio Output
    hdmi:CARD=PCH,DEV=2
    HDA Intel PCH, HDMI 2
    HDMI Audio Output

    With some more experimentation with the non-surround sound outputs, the following command line finally plays the piano sound:

    aplay -vv ~/test/piano2.wav -D hdmi:0,1

    Now the question is how do I configure the system to use this? I tried making a .asoundrc file with the following and rebooting, but nothing happened (and the file disappeared):

    pcm.!default {
    slave.pcm "hdmi:0,1"
    }

    I feel like I'm close. I just need to know how to force the sound to hdmi:0,1.


  • Global moderator
    Team

    May be @OyyoDams @Bkg2k or @Arkheno can help you



  • I have managed to get sound working, although the volume is high and cannot be changed from the Recalbox GUI. But too much sound is better than no sound 😉

    What I did was this:

    1. Remounted root as writable:

    mount -o remount,rw /

    1. Add env var for nano to work:

    export TERM=xterm

    1. Created a .asoundrc file:

    nano ~/.asoundrc

    with the following contents:

    pcm.!default {
    type plug
    slave {
    pcm "hdmi:0,3"
    }
    }
    ctl.!default {
    type hw
    card 0
    }

    1. Saved the above file and rebooted from the GUI.

    I still didn’t have sound and figured I might need another approach, like directly editing the conf file. Before doing that I went one more time to the GUI and tried selecting each audio output. Lo and behold now hw:0,7 worked!

    To see if the settings would stick I rebooted. Sound still worked.

    For grins I ssh’d back in and tool a look at ~/.asoundrc. To my surprise it was different than the file that I created. It now contained the hw:0,7 settings that must have come from my audio change in the GUI. Here’s the current contents of ~/.asoundrc:

    pcm.!default {
    type hw
    card 0
    device 7
    }

    ctl.!default {
    type hw
    card 0
    }

    Apparently the HDMI device 7 does work on my hardware as long as it’s set as the asla default? Strikes me as odd that I could not get this to work when calling aplay directly.

    Anyway it appears that the real issue here is that the absence of a writable ~/.asoundrc file was the problem all along. Making the partition writable and creating this file has now allowed recalbox to be able to successfully write its own contents here and make sound work.

    If I'm right about this and Recalbox needs to be able to create and write to the ~/.asoundrc file then this seems like a bug.

    I guess I’m happy with this because I have sound. But it’s kind of a pain that the system volume slider is useless. It seems like the PC is now pumping out full volume, so I have to turn the TV sound bar way down when using recalbox.

    It would be nice to be able to specify HDMI as the output and be able to control the volume. If anyone has ideas, please let me know. Otherwise I’ll just take what I have as a win.



Want to support us ?

198
Online

79.1k
Users

20.3k
Topics

149.0k
Posts