A lot of evolutionary steps to support sound in Linux occurred. Most new steps include backward compatibility features.
A full featured multi user desktop PC is using today pipewire as sound server (or better Multimedia Service, since it supports also video ). A sound server allows to get sound from various applications and pass it to the sound hardware. Without sound server an application would take the sound hardware and other sound application would not find an available sound hardware.
Before sound servers as pipewire became popular alsa the Advanced Linux Sound System got used. It contains of two parts the kernel drivers and the user space library, both are still relevant.
The kernel device drivers for the sound hardware are found under the name alsa but are used by sound servers as pipewire.
The alsa user space tools are still used to test and analyze the sound system.
The sound server pipewire is considered as replacement for pulseaudio and jack.
pipewire just requires the alsa kernel device drivers but does not require the alsa daemon to run.
It is not mandatory to use a sound server as pipewire. Small single purpose devices or headless systems might use alsa.
The configuration is in /usr/share/pipewire/pipewire.conf and works usually fine. If not happy, cp /usr/share/pipewire/pipewire.conf /etc/pipewire/pipewire.conf
to have a system wide customization or cp /usr/share/pipewire/pipewire.conf ~/.config/pipewire/pipewire.conf to have a customization per user and edit.
pipewire is started automatically via user systemd services at the users login.
To set it up, the user (not root) needs to: systemctl --user enable --now pipewire pipewire-pulse wireplumber
The command:
copies if necessary files from /usr/lib/systemd/user/ to the user ~/.config/systemd/user/
enables to run the services at next boot and user login
starts the services now
There are 3 user services
pipewire the pipewire service
pipewire-pulse the backward support for applications requiring pulseaudio the successor of pipewire
pactl info will show if the pulseaudio interface works and uses pipewire
wireplumber is a Multimedia Service Session Manager that allows to switch media streams to the hardware devices on the fly.
As regular user
systemctl --user status pipewire pipewire-pulse wireplumber will show if the user services run
To have alsa support for pipewire set the pipewire-alsa useflag in Gentoo Linux.
alsa applications will be able to access pipewire when putting the following
defaults.pcm.device 0
defaults.ctl.device 0
pcm.!default {
type plug
slave.pcm "pipewire"
}
ctl.!default {
type plug
slave.pcm "pipewire"
}
to /etc/asound.conf
Install alsa-utils
aplay -l, aplay --list-devices or cat /proc/asound/cards to lists the alsa hardware that is used by pipewire as well
aplay /usr/share/sounds/alsa/* will then talk
cat /proc/asound/cards for endless talking and Ctrl+C
speaker-test -c 2 -t sine -f 1000 -D hw:2,0 on the USB device with headphone attached that appears as card 2