LinuxCommandLibrary

speaker-test

Test audio output devices

TLDR

Test the default speakers with pink noise

$ speaker-test
copy

Test the default speakers with a sine wave
$ speaker-test [[-t|--test]] sine [[-f|--frequency]] [frequency]
copy

Test the default speakers with a predefined WAV file
$ speaker-test [[-t|--test]] wav
copy

Test the default speakers with a WAV file
$ speaker-test [[-t|--test]] wav [[-w|--wavfile]] [path/to/file]
copy

SYNOPSIS

speaker-test [options]

PARAMETERS

-D device
    Select the ALSA device to use. The default device is 'default'.

-c channels
    Specify the number of channels to test. Examples: 2 (stereo), 6 (5.1 surround).

-r rate
    Set the sample rate in Hz. The default rate is 48000.

-f frequency
    Set the test tone frequency in Hz. The default frequency is 440.

-t wave
    Select the waveform to use for the test tone. Common options: 'sine', 'square', 'sawtooth', 'mod'. The default wave is 'sine'.

-l loops
    Specify the number of loops to play the test sequence. Use 0 for infinite looping. The default is 3.

-p period_size
    Set the period size in frames. Adjusting this may help avoid buffer underruns.

-b buffer_size
    Set the buffer size in frames. Adjusting this may help avoid buffer underruns.

-s separator
    Set the separator string between channel outputs. The default separator is a newline.

-w nloops
    Number of wakeup loops. (Used for latency measurements).

-m chmap
    Use a channel map with a specific name.

-W
    Selectively enable and disable channel map elements.

-q
    Quiet mode, suppress verbose output.

-v
    Verbose mode.

-h
    Display help message and exit.

DESCRIPTION

The `speaker-test` command is a tool provided by the Advanced Linux Sound Architecture (ALSA) project, designed to test audio output devices. It sends a sequence of test tones to different speakers in a surround sound setup or a single speaker to verify proper audio output and channel configuration. It allows users to identify issues like incorrect channel mapping (e.g., left and right channels swapped), muted speakers, or problems with audio hardware. `speaker-test` is invaluable for troubleshooting audio problems, especially after configuring or upgrading audio drivers or hardware. The utility supports multiple output devices and audio formats and allows users to customize the test tones. It works via command line, making it suitable for scripts and remote testing. The core utility relies on ALSA libraries for direct access to audio devices and can be used to check for general sound output and verify correct channel configuration, enabling the resolution of issues related to speaker configuration and volume control.

IMPORTANT NOTES

Root Privileges: Sometimes, accessing certain audio devices requires root privileges. Use sudo speaker-test if you encounter permissions errors.
Device Names: Use aplay -l to list available sound cards and devices. This will help determine the correct device name to use with the -D option.
Troubleshooting Buffer Underruns: If you experience choppy audio or buffer underruns, try increasing the -p (period size) and -b (buffer size) values.
Channel Mapping: Verify the correct channel mapping (e.g., front left, front right, center, subwoofer, etc.) to ensure proper speaker configuration. Incorrect channel mapping can result in sound coming from the wrong speakers.

SEE ALSO

aplay(1), alsamixer(1)

Copied to clipboard