The pulseaudio interface

:warning: As of snapd 2.41, this interface is deprecated and the audio-playback and audio-record interfaces should be used instead. They provide access to PulseAudio and will provide access to other sound servers in the future.

pulseaudio enables access to the PulseAudio sound server for sound playback and recording.

Auto-connect: no

Note: The audio-playback interface is auto-connected.

ⓘ This is a snap interface. See Interface management and Supported interfaces for further details on how interfaces are used.

1 Like

In order for a snap to successfully connect to PulseAudio, the following needs to be done:

  1. request and connect one of pulseaudio or audio-playback (mentioned for completeness)
  2. add ${SNAP}/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio to LD_LIBRARY_PATH
  3. point libpulse at the pulseaudio socket, e.g., in a wrapper:
    papath="$XDG_RUNTIME_DIR/../pulse/native"
    if [ ! -e "$papath" ]; then
        echo "Cannot not find '$papath'"
        exit 1
    fi
    export PULSE_SERVER="unix:$papath"

(I got this from tests/lib/snaps/test-snapd-pulseaudio/files/bin/pawrap in the snapd source, which seems to imply this is how it’s designed to work.)

1 Like

It might be worth noting that this does not apply to Ubuntu Core, where pulseaudio autoconnects and audio-playback is not yet supported.

Thank you - I’d been following the previous thread and was going to comment. But you’re right, I’ll update the doc here to make it clear.