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.

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

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.

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: