Friday, 20 October 2017

Fixing broken HDMI audio

Recently I noticed that I had no HDMI audio when running kernels starting from v4.12.0 on an Intel Compute Stick model STK1AW32SC (Cherry Trail).

First I ran the command 'aplay -l' to see I had an HDMI LPE Audio device. In fact I had three:


I then tried playing an audio file on the default device with 'aplay /usr/share/sounds/alsa/Front_Left.wav' which didn't work:


So I listed the PCM devices with 'aplay -L':


and tested each PCM in turn:


which confirmed that audio worked on device 2. 

As the default sink device is 0:


it needs to be changed by editing '/etc/pulse/default.pa'. I can do this manually:


 or write and use a script:


The advantage of the script is that I can make use of it when respinning an ISO with 'isorespin.sh' (using the '-f' option) and automatically fix HDMI audio in the respun ISO for use on this device.

After running the script whilst using Ubuntu 'pulseaudio' needs to be restarted (using 'pulseaudio -k' is sufficient) for the changes to take effect:


Now playing an audio file on the default device with 'aplay /usr/share/sounds/alsa/Front_Left.wav' works together with sound in Chrome and other applications.

Please donate if you find this tip helpful using the following link http://goo.gl/nXWSGf.

19 comments:

  1. I can read as far as aplay -L , but the later text is too small and blurred . I am using the Lenovo 100s , and am useless at linux having recently come over from windows because of the ghastly update schedule. Please post the actual commands full size !!

    ReplyDelete
    Replies
    1. The actual commands will vary depending you your device. In the examples below I substitute '0,2' for ',' as this was one of the values returned by 'aplay -l'.

      Testing command:
      aplay -D plughw:, /usr/share/sounds/alsa/Front_Left.wav
      e.g.
      aplay -D plughw:0,2 /usr/share/sounds/alsa/Front_Left.wav

      Script command:
      sed -i 's/#load-module module-alsa-sink/load-module module-alsa-sink device=hw:,/' /etc/pulse/default.pa
      sed -i '/### Automatically load driver modules depending on the hardware available/,/.endif/ s/^/# LINUXIUM #/' /etc/pulse/default.pa
      e.g.
      sed -i 's/#load-module module-alsa-sink/load-module module-alsa-sink device=hw:0,2/' /etc/pulse/default.pa
      sed -i '/### Automatically load driver modules depending on the hardware available/,/.endif/ s/^/# LINUXIUM #/' /etc/pulse/default.pa

      Checking sinks command:
      pacmd list-sinks

      Also clicking on the images should open a window with them displayed full size after which you can download and zoom them.

      Delete
  2. Awesome, thanks for the solution! I'll try it this weekend and report back.

    ReplyDelete
  3. Thanks! You are save me from glitchy Windows on Meegopad t08, that even freeze on youtube videos on full screen even after all updated and fresh drivers =) Sound works on default Ubuntu 17.10, other things works good, except of Broadcomm WiFi.

    ReplyDelete
    Replies
    1. Did you copy across the wifi firmware from Windows and also restart the 'systemd' service? See both 'Wifi issues' and 'Bluetooth issues' in my documentation ('https://linuxiumcomau.blogspot.com.au/2017/06/customizing-ubuntu-isos-documentation.html').

      Delete

  4. Lenovo 100S. Sound fix for now . If u can work with an external USB sound device , This works well :- http://www.ebay.co.uk/itm/New-Mini-USB-2-0-3D-Virtual-12Mbps-External-7-1-Channel-Audio-Sound-Card-Adapter/192059592566?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649


    Not a long term solution because mint 18.4 is supposed to connect to the Lenovo sound device OK. -- but for £1 it is worth it just to HEAR news on wifi TV

    ReplyDelete
  5. Asus E200 HA Linux 4.13 Artfull
    Doesn't work :(

    tested from hw0,0 to hw1,2

    moi@MonPC:~$ pulseaudio
    W: [pulseaudio] pid.c: Stale PID file, overwriting.
    E: [pulseaudio] module-alsa-sink.c: Failed to parse module arguments
    E: [pulseaudio] module.c: Failed to load module "module-alsa-sink" (argument: "device=hw:0,2 ####################"): initialization failed.
    E: [pulseaudio] main.c: Module load failed.
    E: [pulseaudio] main.c: Échec lors de l'initialisation du démon
    moi@MonPC:~$ pulseaudio
    E: [pulseaudio] module-alsa-sink.c: Failed to parse module arguments
    E: [pulseaudio] module.c: Failed to load module "module-alsa-sink" (argument: "device=hw:0,1 ####################"): initialization failed.
    E: [pulseaudio] main.c: Module load failed.
    E: [pulseaudio] main.c: Échec lors de l'initialisation du démon
    moi@MonPC:~$ pulseaudio
    E: [pulseaudio] module-alsa-sink.c: Failed to parse module arguments
    E: [pulseaudio] module.c: Failed to load module "module-alsa-sink" (argument: "device=hw:0,0 ####################"): initialization failed.
    E: [pulseaudio] main.c: Module load failed.
    E: [pulseaudio] main.c: Échec lors de l'initialisation du démon
    moi@MonPC:~$ pulseaudio
    E: [pulseaudio] module-alsa-sink.c: Failed to parse module arguments
    E: [pulseaudio] module.c: Failed to load module "module-alsa-sink" (argument: "device=hw:1,0 ####################"): initialization failed.
    E: [pulseaudio] main.c: Module load failed.
    E: [pulseaudio] main.c: Échec lors de l'initialisation du démon
    moi@MonPC:~$ pulseaudio
    E: [pulseaudio] module-alsa-sink.c: Failed to parse module arguments
    E: [pulseaudio] module.c: Failed to load module "module-alsa-sink" (argument: "device=hw:1,1 ####################"): initialization failed.
    E: [pulseaudio] main.c: Module load failed.
    E: [pulseaudio] main.c: Échec lors de l'initialisation du démon
    moi@MonPC:~$ pulseaudio
    E: [pulseaudio] module-alsa-sink.c: Failed to parse module arguments
    E: [pulseaudio] module.c: Failed to load module "module-alsa-sink" (argument: "device=hw:1,2 ####################"): initialization failed.
    E: [pulseaudio] main.c: Module load failed.
    E: [pulseaudio] main.c: Échec lors de l'initialisation du démon
    moi@MonPC:~$ pulseaudio
    E: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
    E: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="1" name="platform-bytcht_nocodec" card_name="alsa_card.platform-bytcht_nocodec" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1""): initialization failed.

    ReplyDelete
  6. It was working on zesty 4.10 !! ...

    ReplyDelete
  7. ASUS T100HA. Same problem basically. It turns out that (in my case) the chtrt5645 card is available due to the linuxium added driver stuff but the pulseaudio daemon will not start. I've tried various things suggested on the net but nothing yet. I'll keep hitting it and let you know. If anyone has suggestions I'd love to hear them.

    ReplyDelete
    Replies
    1. Most likely a miss-match between the combination of kernel, PulseAudio and UCM files.

      Delete
  8. I have a problem with my Kino Slimnote 14.1. When I play laptop on battery charger everythings works fine, but when I play laptop on battery a don't have sounds...

    ReplyDelete
    Replies
    1. Weird. Does anything change between running 'aplay -L' in each scenario?

      Delete
  9. Nothings change. This is my "aplay-L":

    null
    Discard all samples (playback) or generate zero samples (capture)
    pulse
    PulseAudio Sound Server
    default:CARD=Audio
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    Default Audio Device
    sysdefault:CARD=Audio
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    Default Audio Device
    front:CARD=Audio,DEV=0
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    Front speakers
    hdmi:CARD=Audio,DEV=0
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    HDMI Audio Output
    dmix:CARD=Audio,DEV=0
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    Direct sample mixing device
    dmix:CARD=Audio,DEV=1
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    Direct sample mixing device
    dsnoop:CARD=Audio,DEV=0
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    Direct sample snooping device
    dsnoop:CARD=Audio,DEV=1
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    Direct sample snooping device
    hw:CARD=Audio,DEV=0
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    Direct hardware device without any conversions
    hw:CARD=Audio,DEV=1
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    Direct hardware device without any conversions
    plughw:CARD=Audio,DEV=0
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    Hardware device with all software conversions
    plughw:CARD=Audio,DEV=1
    Intel HDMI/DP LPE Audio, Intel HDMI/DP LPE Audio
    Hardware device with all software conversions
    default:CARD=bytcrrt5640
    bytcr-rt5640,
    Default Audio Device
    sysdefault:CARD=bytcrrt5640
    bytcr-rt5640,
    Default Audio Device
    dmix:CARD=bytcrrt5640,DEV=0
    bytcr-rt5640,
    Direct sample mixing device
    dmix:CARD=bytcrrt5640,DEV=1
    bytcr-rt5640,
    Direct sample mixing device
    dsnoop:CARD=bytcrrt5640,DEV=0
    bytcr-rt5640,
    Direct sample snooping device
    dsnoop:CARD=bytcrrt5640,DEV=1
    bytcr-rt5640,
    Direct sample snooping device
    hw:CARD=bytcrrt5640,DEV=0
    bytcr-rt5640,
    Direct hardware device without any conversions
    hw:CARD=bytcrrt5640,DEV=1
    bytcr-rt5640,
    Direct hardware device without any conversions
    plughw:CARD=bytcrrt5640,DEV=0
    bytcr-rt5640,
    Hardware device with all software conversions
    plughw:CARD=bytcrrt5640,DEV=1
    bytcr-rt5640,
    Hardware device with all software conversions


    Could it be something with a battery? I noticed that when a battery has 30% of its power and plugged in the charger, the system does not see the power from the charger, even though the LED on the computer is on.

    ReplyDelete
    Replies
    1. It does sound (terrible pun) like a kernel issue. I'll keep an eye on bugzilla and patch queues to see if anyone else has encountered it.

      Delete
    2. I would be grateful if you could find a solution to the problem. Thank you very much!

      Delete
  10. so far my Chuwi 15.6 (Atom/rt56115) does not recognize any audio device. None of the PCM's work. I am also trying to fix and test this with a Live USB (w/ persistence) but I think it will require testing a full install. Not ready to do anything that drastic yet...

    Also, how can I customize with isorespin if the only OS I have to work with is Windows 10?

    ReplyDelete
    Replies
    1. Is 'rt56115' correct?

      You can respin on Windows if you use a VM. See my documentation for details.

      Delete
  11. Thanks a lot ! I have a GPD Pocket and the audio HDMI work now.

    ReplyDelete