speaker-test
Test audio output devices
TLDR
Test the default speakers with pink noise
Test the default speakers with a sine wave
Test the default speakers with a predefined WAV file
Test the default speakers with a WAV file
SYNOPSIS
speaker-test
[options]
PARAMETERS
-D, --device=NAME
Specifies the ALSA sound device to use (e.g., 'hw:0,0' or 'default').
-c, --channels=CHANNELS
Sets the number of audio channels for the stream (e.g., 2 for stereo, 6 for 5.1 surround).
-r, --rate=RATE
Defines the sample rate in Hertz (Hz) for the audio stream (e.g., 44100, 48000).
-f, --format=FORMAT
Sets the sample format (e.g., S16_LE for 16-bit signed little-endian, U8 for 8-bit unsigned).
-t, --test=TYPE
Determines the type of audio test: 'sine' (default sine wave), 'pink' (pink noise), or 'wav' (custom WAV file).
-l, --nloops=LOOPS
Specifies how many times to loop through all speaker channels. A value of 0 means loop endlessly.
-s, --speaker=SPEAKER
(Deprecated) Tests a specific speaker channel by its number (1 to N). For looping through all, use -l.
-F, --file=FILE
Provides the path to a WAV file to be used when the test type is 'wav' (-t wav).
-S, --sine-freq=FREQ
Sets the frequency in Hz for the sine wave test (default is 440 Hz).
-v, --verbose
Enables verbose output, displaying more detailed information about the test process.
-h, --help
Displays the command's help message and available options.
-V, --version
Prints the version information of the speaker-test utility.
DESCRIPTION
speaker-test
is a command-line utility from the ALSA utilities package, designed to assist users in verifying the correct setup and functionality of their multi-channel audio systems. It generates audio tones, such as sine waves or pink noise, and plays them sequentially through each configured speaker channel. This helps users identify if their speakers are correctly wired and if the operating system's channel mapping (e.g., front-left, front-right, center, surround) matches their physical speaker arrangement.
The tool supports various audio parameters, including sample rate, number of channels, and audio format, allowing for flexible testing across different hardware configurations. It's particularly useful for diagnosing issues in surround sound setups or simply ensuring that all connected speakers are producing sound as expected. It operates directly with ALSA, providing a low-level audio test without relying on higher-level sound servers like PulseAudio or PipeWire, though it can work through their ALSA compatibility layers.
CAVEATS
Requires the ALSA sound system to be properly configured and functional on your Linux machine. While it can operate through ALSA compatibility layers provided by higher-level sound servers like PulseAudio or PipeWire, direct ALSA access might be necessary for some configurations. Be mindful of your speaker volume before starting the test, as the generated tones can be loud, especially with higher frequencies or longer durations.
COMMON USAGE EXAMPLES
Here are a few common scenarios for using speaker-test
:
Stereo Test (one loop):speaker-test
-c 2 -l 1
(Plays sine wave through left, then right speaker once)
5.1 Surround Sound Test (Continuous):speaker-test
-c 6 -l 0
(Cycles through all 6 channels continuously until interrupted with Ctrl+C)
Specific Speaker Test (Front-Left, 440Hz, for stereo):speaker-test
-c 2 -s 1
(Plays tone on the first channel only for a stereo setup; note: -s is deprecated)
Test with Pink Noise for Stereo:speaker-test
-c 2 -t pink
(Plays pink noise through left, then right channel continuously)
Test with Custom WAV File:speaker-test
-t wav -F /path/to/my_test_sound.wav
(Plays a specified WAV file once per channel, cycling through configured channels)
INTERACTION WITH SOUND SERVERS
While speaker-test
interacts directly with ALSA, modern Linux distributions often use higher-level sound servers like PulseAudio or PipeWire. These servers typically provide an ALSA compatibility layer, allowing speaker-test
to function without explicit configuration. However, if you encounter issues, ensure that your sound server is running and that its ALSA plugin or module is enabled. You can also specify an ALSA device that directly bypasses the sound server, e.g., -D hw:0,0, if you know your sound card's device ID, though this is less common for general testing.
HISTORY
speaker-test
is an integral part of the ALSA Utilities (alsa-utils) project, which provides essential command-line tools for managing the Advanced Linux Sound Architecture (ALSA). ALSA itself was developed as a replacement for the older OSS (Open Sound System) and has been the default low-level audio system in Linux for many years. speaker-test
was created to offer a simple, direct method for hardware-level audio output verification, crucial for sound card manufacturers and end-users setting up multi-channel audio.