alsa allows access to raw ALSA audio playback and recording devices. This is equivalent to direct driver access to your audio hardware and may block other applications from recording or playing sound.
To provide better audio sharing and input and output configuration, it’s recommended that most snaps access audio functionality through the system audio layer, such as PulseAudio, via the audio-playback and audio-record interfaces.
However, raw access to ALSA devices using this interface can provide a slight performance advantage with input and output latency and avoid resampling which can reduce audio quality.
The musical notation and composition application, MuseScore, is a good example of a snap that uses the ALSA interface.
To connect a snap to the ALSA interface, run the following command:
$ sudo snap connect <snap name>:alsa
alsa interface is not auto-connected, in part, because not all hardware will multiplex clients and therefore may block audio.
The libasound2 library needs to be included in a snap’s
stage-packages, of the part which uses ALSA, either directly or through some other package which brings it in (or manually compiled).
The snapcraft.yaml for MuseScore includes an ALSA interface definition:
The source code for this interface is in the snapd repository: