PulseAudio output device not mantained after reboot

  • Dear guys,

    I am figthing with this and spending a lot of time. No success....

    I have libreelec running on rpi 3b+ with suptronics x5000 DAC-AMP.

    I have set up pulseaudio to get bluetooth audio from smartphone as explained this:

    https://wiki.libreelec.tv/configuration/pulseaudio

    Next step is sending auto through network to other libreelec player.

    To reconnect pulseaudio at startup I added to autostart.sh the following:

    pactl load-module module-udev-detect

    PulseAudio is running correctly but also if I select it as audio output device I have on reboot the output back to PI:HDMI

    I tried to solve also with audio profiles addon in order to "force" a profile at startup but no success.

    If then I select manually everything is running correctly.

    I tried also to put con config.txt

    dtparam=audio=off

    Any idea?

    Thanks!

  • Found something that's the log:

    2021-10-11 00:43:24.736 T:1904210816 INFO: CAESinkALSA::Initialize - Attempting to open device "@"

    2021-10-11 00:43:24.742 T:1904210816 INFO: CAESinkALSA - Unable to open device "sysdefault" for playback

    2021-10-11 00:43:24.744 T:1904210816 INFO: CAESinkALSA - Unable to open device "default" for playback

    2021-10-11 00:43:24.744 T:1904210816 INFO: CAESinkALSA - ALSA: /var/lib/jenkins/LE/build4/workspace/RPi2/http://LibreELEC.tv/build.LibreELEC-RPi2.arm-9.2.8/alsa-lib-1.1.9/src/pcm/pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front

    2021-10-11 00:43:24.744 T:1904210816 INFO: CAESinkALSA - Unable to open device "front" for playback

    2021-10-11 00:43:24.744 T:1904210816 ERROR: CAESinkALSA::Initialize - failed to initialize device "@"

    2021-10-11 00:43:24.745 T:1904210816 DEBUG: CActiveAESink::OpenSink - trying to open device PI:HDMI

    it look that pulseaudio or the external DAC is not fully loaded when kodi starts.

    Is there a way to delay something in order to fix it?

  • If you apply Pulse config via /storage/.config/pulse-daemon.conf.d/daemon.conf it will be processed at startup and overrides the embedded config file before Kodi starts. The other alternative is creating a systemd service file in /storage/.config/system.d to run commands or a script with dependencies to set when in the boot sequence the service is run, e.g. after Pulse and before Kodi.

  • Not success, I removed everything from autostart.sh and I try to put command:

    load-module module-udev-detect

    on daemon.conf and also in default.pa in folder /storage/.config/

    What is really strange is that in the default.pa the "load-module module-udev-detect" should run.

    And at the end everything works correctly if I digit in ssh:

    systemctl stop kodi

    pactl load-module module-udev-detect

    systemctl start kodi

    ..... no idea....

  • This is my autostart.sh:

    Bash
    #!/bin/sh
    pactl load-module module-udev-detect
    pactl set-default-sink alsa_output.0.stereo-fallback
    pactl set-default-source alsa_output.0.stereo-fallback.monitor

    Log looks ok:

    bet the Audio is alsway set back to PI:HDMI

    If it should work from Autostart I have to find the way!

    Edited once, last by flyer (October 14, 2021 at 10:07 AM).

  • There is a failing and not failing log!?

    Add set -x to the start of the script to see what is executed.

    To log the PA status add pactl info;pactl list

  • No, there's no failing and not failing log, the script failure was because of my fault, now I corrected the script and the post and that's the log without error (the problem was for some permission on autostart.sh).

    The problem is that on KODI the audio device PI:HDMI is always selected at boot, if then I select manually PulseAudio everything is running correctly.

    I would like to have PA selected as default at boot.

    Edited once, last by flyer (October 14, 2021 at 11:41 AM).

  • Ok now I am on PulseAudio now and trying to set correctly the quality with my DAC:

    I modify daemon.conf as follow:

    Code
    default-sample-format = s24le
    default-sample-rate = 44100
    alternate-sample-rate = 96000
    default-sample-channels = 2
    default-channel-map = front-left,front-right

    If I digit

    Code
    pactl info

    everything looks ok:

    but if I digit:

    pactl list sinks

    I have the following:

    Same for pact list sources where I have 32 bit.

    Why in the sinks the bit are 32 when I set 24 on the daemon.conf?

    Some other question:

    - How can I check in real time the bitrate running trough the source -> pulseaudio -> alsa to check the configuration?

    - Do I have to enable manually i2s bus?

    - If i understood well: default-sample-rate define the minimum bitrate (if less -> upsampling) while alternate-sample-rate is the maximum (if more -> downsampling). but if the final soundcard is setted to lower sample rate the final calculation will be another downsampling. Is it correct? How can I check if the driver are managing correctly my DAC (specs 24bit-192kHz)?

    Many question.... =O