The Advanced Linux Sound Architecture (ALSA) subsystem provides audio and MIDI capabilities to Linux systems, including a user space library to simplify application programming (alsa-lib) and support for the older Open Sound System (OSS) architecture through legacy compatibility modes. Specifically for system-on-chips, the architecture defines an ALSA system-on-chip (ASoC) layer which provides optimized support for embedded devices.
The ASoC layer divides an embedded audio system into:
-
Machine driver, with machine-specific code
-
Platform driver, with platform-specific audio interface support such as I2S, AC97, or PCM
-
Codec driver, with platform-independent code
The ASoC layer is described in detail at the Linux kernel documentation.
Audio interfaces
The ConnectCore 6 SBC supports the following audio interfaces:
-
HDMI audio
-
SGTL5000 audio
Audio usage from user space
Listing the available audio devices
To list the available audio devices on the system:
# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sgtl5000audio [sgtl5000-audio], device 0: HiFi sgtl5000-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: imxhdmisoc [imx-hdmi-soc], device 0: i.MX HDMI Audio Tx hdmi-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
Selecting the default audio device
X11-based systems
On XWayland images, pulseaudio manages the audio sinks. You can list the available audio sinks with the following command:
# pactl list short sinks
0 alsa_output.platform-sound-hdmi.19.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
1 alsa_output.platform-sound.18.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
To change the default sink, you also use the pactl
command using the sink index number or the sink name:
# pactl set-default-sink 1
# pactl set-default-sink alsa_output.platform-sound.18.analog-stereo
To make this configuration permanent across reboots, edit the file /etc/pulse/default.pa
and add the following:
1 set-default-sink alsa_output.platform-sound.18.analog-stereo
Playback and recording
You can access the sound driver using the ALSA API.
The ALSA utilities package alsa-utils
also offers user space applications:
-
aplay
: for playback -
arecord
: for recording -
alsactl
: for configuration -
amixer
: for specific control setup
Several predefined configuration files are stored at /var/lib/alsa/
:
-
asound.inline_play.state
: for recording from LINE-IN and playback -
asound.inline.state
: for recording from LINE-IN only (no playback) -
asound.micro_play.state
: for recording from MIC and playback -
asound.micro.state
: for recording from MIC only (no playback) -
asound.play.state
: for playback only
To enable a configuration profile, run a command like this:
# alsactl restore -f /var/lib/alsa/asound.inline.state