ALSA audio configuration for simultaneous HDMI and analogue audio output

  • Hello,

    I set up a Raspberry Pi 3 Model B+ with Libreelec 9.2.6 and Kodi 18.9.


    I'm struggling to get the audio output simultaneous to the speakers. The Pi is connected via HDMI to a TV which is then connected to a soundbar. Additionally the PI is connected via the 3.5 mm audio jack to an ampilfier to a set of speakers.

    The standard audio setting "PI: HDMI and analogue" works in that way, that there is a signal on both oututs but of course with a significant delay on the HDMI due to the "longer" signal processing (Pi->TV->Soundbar)

    I read with ALSA I could could add a latency to the analogue output to get them harmonized in the end.

    But I'm already struggling to get a signal at all at the audio jack output, I'm not quite sure how to tackle that. For me it seams like that ALSA doesn't recognize a analogue sound device.

    I read various pages in the net and searched on this page, but i'm still beginner in terms on Linux and ALSA in particular.


    The use case would be playing audio with Librespot as well as potentially with Snapcast.


    Is somebody able to help me to get it work?


    These are the results of aplay. If anything further is required


    Thanks for your help

  • Hi


    same here. first time using libreelec, was using native kodi on arch linux before. simultaneous audio output was possible by adding this

    Code
    ### Load analog device
    load-module module-alsa-sink device=hw:0,0
    load-module module-combine-sink sink_name=combined
    set-default-sink combined


    to /etc/pulse/default.pa


    and set simultaneous output in pavucontrol "Output Devices" tab.


    Is there a way to achieve this in libreelec (fs is read only...)?


    Sound works for both outputs separately but not both at the same time


    machine: x86_64


    regards

  • Thank you


    But this looks quite hacky and results are also not that promising. is there a way to achieve simultaneous audio output by keep alsa as audio output?


    Thanks

  • I haven't found a solution for analogue audio delay. You can delay A/V separately on HDMI, but you can't speed it up.


    Alsa has a playback buffer size option, which could create a fitting delay, but I'm not familiar with it.


    For electronic people, it could be easier to build a hardware analogue audio delayer for a couple of bucks.


    Or buy an HDMI audio extractor with analogue output. That output will be in-sync, and has better quality than RPi analogue audio.

    Flexin' vinyl, jammin' break beats. 8)

  • Thanks for the hints already.


    I'm still not getting where I wanted.

    The "out of the box" LE soundoption PI: HDMI and ANALOGUE works with Librespot with the mentioned delay. ALSA and Pulseaudio are mentioned there as well.

    Snapclient lists only ALSA soundcards as available option.

    And with ALSA I only get an output to HDMI so far


    So my approach would be to get a fix for all applications to configure ALSA with a delay between HMDI and analogue.

    But first I need to get the jack work at all with ALSA and there I'm stuck.


    Delaying video output is not really necessary here, it is mainly driven by audio only (Snapclient and Librespot)

  • I suggest to go for the HDMI audio extractor. The RPi analogue jack isn't supported very well, and it's lousy quality isn't worth the effort.

    Flexin' vinyl, jammin' break beats. 8)

  • But am I not running into the same problem.

    Assuming that I would put an HDMI audio extractor wouldn't that also result in an asynchron audio?


    I mean the HDMI signal goes through the extractor to the TV and then to a soundbar, the second way thr audio signal would be get extracted and through the amplifier to the speakers.

    I would think that's extremely unlikely that the this has the same timing in the end.

  • I'm not sure whether the extractor synchronizes analogue and digital output. That's no LE problem. Question: Why don't you use your TV's headphone jack to feed your amp?

    Flexin' vinyl, jammin' break beats. 8)