Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Audio Configuration

Linux provides several command-line tools for managing audio. The two main sound systems are ALSA (Advanced Linux Sound Architecture) and PulseAudio, with PulseAudio running on top of ALSA.

On many modern distributions, PipeWire is now the default audio engine and provides PulseAudio compatibility. In practice, this means many PulseAudio tools still work even when PipeWire is active.

Audio Troubleshooting Order for Beginners

Use this order before deep tuning:

  1. Confirm output device and volume in desktop sound settings.
  2. Check mute state in pavucontrol or alsamixer.
  3. Confirm detected devices with pactl list sinks and aplay -l.
  4. Test output with speaker-test -c 2.
  5. Restart user audio services if needed.

Example service checks on PipeWire systems:

systemctl --user status pipewire pipewire-pulse wireplumber --no-pager
systemctl --user restart pipewire pipewire-pulse wireplumber

PulseAudio Commands (pactl)

The pactl command is used to control the PulseAudio sound server:

# List audio sources and sinks
pactl list sources        # List input devices
pactl list sinks         # List output devices

# Volume control
pactl set-sink-volume @DEFAULT_SINK@ 50%     # Set volume to 50%
pactl set-sink-mute @DEFAULT_SINK@ toggle    # Toggle mute

# List loaded modules
pactl list modules

ALSA Mixer (alsamixer)

alsamixer is a terminal-based mixer program for ALSA:

alsamixer    # Open the mixer interface

Navigation in alsamixer:

  • Arrow keys: Navigate between channels
  • Up/Down: Adjust volume
  • M: Toggle mute
  • F6: Select sound card
  • Esc: Exit

Common Audio Troubleshooting Commands

# Restart PulseAudio
pulseaudio -k        # Kill the PulseAudio daemon
pulseaudio --start   # Start PulseAudio

# Check audio devices
aplay -l             # List all ALSA playback devices
arecord -l          # List all ALSA recording devices

# Test audio output
speaker-test -c 2    # Test stereo speakers

If pulseaudio --start is not available on your distribution, use PipeWire service restart commands instead.

Audio Device Management with pavucontrol

While pavucontrol is technically a GUI application, it can be installed and launched from the terminal:

sudo apt install pavucontrol   # Install on Debian/Ubuntu
pavucontrol                    # Launch the control interface

Pipewire Audio System

Pipewire is the modern replacement for both PulseAudio and JACK. It maintains compatibility with PulseAudio clients, so pactl commands work with Pipewire. Additionally, Pipewire provides its own tools:

# Check Pipewire status
pw-cli status
pw-top                # Show real-time audio processing graph

# List audio devices
pw-dump               # Detailed info about audio devices and nodes
pw-cli list-objects   # List all Pipewire objects

# Control specific nodes
pw-cli node-id        # Get ID of audio nodes
pw-metadata -n settings 0 clock.force-rate 48000  # Set sample rate

# Monitor audio
pw-mon               # Monitor Pipewire events in real-time

You can still use PulseAudio tools with Pipewire:

  • pactl commands work as shown above
  • pavucontrol works normally
  • ALSA applications work without modification

Note: Most modern Linux distributions are transitioning to Pipewire as their default audio system due to its improved latency, Bluetooth handling, and compatibility with both PulseAudio and JACK applications.

Common Failure Patterns

  • No output device shown: likely driver or hardware detection issue.
  • Wrong output active: default sink points to HDMI, headset, or inactive card.
  • Mic not working: input source mismatch or muted capture channel.
  • Audio after reboot only: service startup race or profile corruption.

When in doubt, capture current sink and source state before changing many settings:

pactl info
pactl list short sinks
pactl list short sources

Typical Pipewire Package Names:

  • pipewire - Core Pipewire package
  • pipewire-pulse - PulseAudio compatibility layer
  • pipewire-jack - JACK compatibility layer
  • pipewire-alsa - ALSA compatibility layer
  • wireplumber - Session manager for Pipewire

Note: Do NOT use pipewire-media-session, as it is deprecated and replaced by wireplumber.

Last change: