Docker container's audio to OS

  • I have a docker container running with PulseAudio inside. Where should I create a docker volume to from LibreELEC, so PulseAudio can detect the correct device from the container, or so I can manually set it as a sink (output)?

    And is it possible to have LibreELEC use the device alongside the docker container, or will I need to use separate outputs?


    Appreciate any directions.

  • Solved most of the questions here apart from one: multiple audio streams. The solution is dmix, but the file I need is read only: /usr/share/alsa/alsa.conf

    This may be the wrong file, as the official ALSA wiki says it's /etc/asound.conf, but that doesn't exist in LibreELEC.

    Please could someone at LibreELEC point me to the correct file to write to, if possible? :)

  • I'm not sure if /storage/.config/asound.conf still works as an override, but it used to (admittedly a long time ago, so no guarantees it still does).

  • I tested and /storage/.config/asound.conf still works for me, also "/run" was the correct place for PulseAudio. Great!

    Now I think I've setup a dmix device and it's ALSA's default, but how can I make Kodi use it? Since it's not in "settings > system > audio > audio output device", would I need some startup arguments for Kodi? The output I used for dmix doesn't appear in Kodi anymore, presumably because it's being used on boot.

    I know with PulseAudio, all you need to do is make a sink and Kodi should pickup the device.

  • Quick question: does LibreELEC output audio via Pulse or ALSA? It says ALSA next to the output options in Kodi, but I think Pulse always uses ALSA to detect devices.

  • If Kodi does so on its own, when Kodi says "ALSA" next to the output device, it's also playing directly via ALSA?

    Unless I can make the output go through PulseAudio or I can get Kodi to register devices in asound.conf, I may be screwed.

    First, I need to know if the audio is just going through ALSA directly, because in this article:

    Pulseaudio [LibreELEC.wiki]

    It shows Pulse can play / receive audio, though I'm not sure whether it means simultaneously with Kodi.

  • There may be a solution. To my understanding, Kodi uses Pulse whenever it's installed (and running). Unless the Kodi startup args in LibreELEC force ALSA: https://kodi.wiki/view/pulseaudio#forcing_alsa

    All I need to do is get Pulse to autostart before Kodi.

    Anyone at LibreELEC know if "/storage/.config/autostart.sh" will execute always before Kodi, and whether Kodi is forced to use ALSA on start? Many thanks.

  • Finally got it working 100%! Now I just need to set some Pulse settings on OS start. :)

    For this, the file is "/etc/pulse/default.pa", any writable override for this?

  • That file doesn't allow loading modules, so I just used "pactl load-module" in autostart.sh.

    For anyone who finds this thread looking for info, also consider the following:

    • Use the Pulse module "module-udev-detect".

    • Container probably needs to run as root and so do the users in it (for access to Pulse).

    • Won't play audio alongside Kodi if ALSA is used, and UI sounds may need to be turned off for playing while on UI.