The alsa interface

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.

Example

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

Interface documentation:
See Interface management and Supported interfaces for further details on how interfaces are used.


Developer details

Auto-connect: no

The 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).

Code examples

The snapcraft.yaml for MuseScore includes an ALSA interface definition:
https://github.com/pachulo/musescore-snap/blob/master/snap/snapcraft.yaml

The source code for this interface is in the snapd repository:
https://github.com/snapcore/snapd/blob/master/interfaces/builtin/alsa.go


Last updated 2 years ago.