ALSABAT(1)
โจ ALSABAT(1) โ the ALSA Basic Audio Tester ๐
Okay so bestie, this is the manual for alsabat ๐ฆ, a command-line sound tester for the ALSA sound card driver. It's your little helper for alsabat [flags] ๐
๐ NAME
alsabat - command-line sound tester for ALSA sound card driver ๐
๐ธ SYNOPSIS
alsabat [flags]
๐ง DESCRIPTION
Okay so ALSABAT (short for ALSA Basic Audio Tester) is a simple command-line utility made to automate audio driver and sound server testing with barely any human involvement โจ It's lowkey perfect for testing audio quality, stress testing features, and checking audio before and after PM state changes ๐ญ
Here's the vibe: ALSABAT plays an audio stream and captures that same stream through either a digital or analog loopback ๐ง Then it compares the captured stream to the original using an FFT to figure out whether the test case passes or fails. Iconic, no cap ๐ฅ
ALSABAT can run wholly on the machine being tested (that's standalone mode ๐ ). Or it can run in client/server mode, where the alsabat client sits on the target and the server runs on a separate tester machine ๐ซถ Client/server mode still needs a bit of manual synchronization, but it's actively being developed for future releases ๐
The hardware setup might need an analog cable going from the target to the tester machine ๐ Or a cable to create an analog loopback, if the sound hardware you're testing has no loopback mode. An analog loopback cable connects the "line in" jack to the "line out" jack to make a loopback ๐ If you only have headphone and mic jacks (or a combo jack), this simple circuit can be used to create an analog loopback :-
https://source.android.com/devices/audio/loopback.html
If tinyalsa is installed on the system, you can choose tinyalsa as the backend lib of alsabat with the configure option --enable-alsabat-backend-tiny ๐
๐ OPTIONS
-h,--helpโ Help! Shows the syntax ๐-Dโ Picks the sound card to be tested, by name ๐ต-Pโ Picks the playback PCM device ๐-Cโ Picks the capture PCM device ๐๏ธ-fโ Sample format ๐- Recognized sample formats are:
U8S16_LES24_3LES32_LE๐ - Some of these might not be available on your hardware, bestie ๐ญ
- The format shortcuts are:
-f cd(16 bit little endian, 44100, stereo) [-f S16_LE -c2 -r44100] ๐ฟ-f dat(16 bit little endian, 48000, stereo) [-f S16_LE -c2 -r48000] ๐ผ
- If you don't give a format,
S16_LEis used โจ
- Recognized sample formats are:
-cโ The number of channels. Default is one channel ๐ฆ Valid values right now are1or2๐-rโ Sampling rate in Hertz ๐ถ The default rate is44100Hertz. Valid values depend on what your hardware supports ๐-nโ Duration of the generated signal ๐ฐ๏ธ It can be either of two forms:- A decimal integer, meaning number of frames ๐งฎ
- A floating point with the suffix
s, meaning number of seconds โฑ๏ธ
The default is 2 seconds โญ
-kโ Sigma k value for analysis ๐ง Here's the tea: the analysis function reads data from a WAV file, runs an FFT on it to get the magnitude of the frequency vectors, then calculates the average value and standard deviation of those vectors ๐ After that, it defines a threshold:
threshold = k * standard_deviation + mean_value
Frequencies with an amplitude larger than the threshold get recognized as a peak, and the frequency with the largest peak value is recognized as the detected frequency ๐ ALSABAT then compares the detected frequency to the target frequency to decide if the test passes or fails ๐ The default value is 3.0 โจ
-Fโ Target frequency for signal generation and analysis, in Hertz ๐ฏ The default is997.0Hertz. Valid range is(DC_THRESHOLD, 40% * Sampling rate)๐ธ-pโ Total number of periods to play or capture ๐--log=#โ Writes stderr and stdout output to this log file ๐--file=#โ Input WAV file for playback ๐๏ธ--saveplay=#โ Target WAV file to save the capture test content ๐พ--localโ Internal loopback mode ๐ Playback, capture, and analysis all stay internal to ALSABAT. This is meant for developers testing new ALSABAT features, since no audio gets routed outside of ALSABAT ๐งโ๐ป--standaloneโ Adds support for standalone mode, where ALSABAT runs on a different machine from the one being tested ๐๏ธ In standalone mode, sound data can be generated, played back, and captured just like in normal mode, but it won't be analyzed ๐ โโ๏ธ An ALSABAT built without libfftw3 support is always in standalone mode ๐ญ The normal-mode ALSABAT can also skip data analysis using the option--standalone๐--roundtriplatencyโ Round trip latency test โณ Audio latency is the time delay as an audio signal passes through a system. There are lots of kinds of audio latency metrics, and one useful one is round trip latency, which is the sum of output latency and input latency ๐--snr-db=#โ Noise detection threshold in SNR (dB) ๐26dBindicates5%noise in amplitude. ALSABAT will return an error if the signal SNR is smaller than the threshold ๐จ--snr-pc=#โ Noise detection threshold as a percentage of noise amplitude (%) ๐ ALSABAT will return an error if the noise amplitude is larger than the threshold ๐ฅ
๐ EXAMPLES
alsabat -P plughw:0,0 -C plughw:0,0 -c 2 -f S32_LE -F 250
Generates and plays a sine wave of 250 Hertz with 2 channels and S32_LE format, then captures and analyzes it ๐ถ
alsabat -P plughw:0,0 -C plughw:0,0 --file 500Hz.wav
Plays the RIFF WAV file "500Hz.wav", which contains 500 Hertz waveform LPCM data, then captures and analyzes it ๐ฆ
๐ RETURN VALUE
On success, it returns 0 โจ If no peak is detected, it returns -1001 ๐ If only DC is detected, it returns -1002 ๐ญ If the peak frequency doesn't match the target frequency, it returns -1003 ๐
๐ SEE ALSO
aplay(1)๐ง
๐ BUGS
Currently only RIFF WAV format with PCM data is supported. Please report any bugs to the alsa-devel mailing list ๐
๐ซถ AUTHOR
alsabat is by Liam Girdwood <liam.r.girdwood@linux.intel.com>, Bernard Gautier <bernard.gautier@intel.com> and Han Lu <han.lu@intel.com>. This document is by Liam Girdwood <liam.r.girdwood@linux.intel.com> and Han Lu <han.lu@intel.com> ๐
Okay bestie, that's the whole ALSABAT tea ๐๐ Your sound testing era is about to be iconic โจ Stay slay, stay curious, and I'll see you in the next manpage ๐ฆ๐ซถ
๐ฆ where this page comes from
- alpine 3.22: alsa-utils-doc 1.2.14-r0 ยท GPL-2.0-or-later
- alpine 3.23: alsa-utils-doc 1.2.14-r4 ยท GPL-2.0-or-later
- alpine 3.24: alsa-utils-doc 1.2.15.2-r1 ยท GPL-2.0-or-later
- arch rolling: alsa-utils 1.2.16-1 ยท GPL-2.0-or-later
- debian bookworm: alsa-utils 1.2.8-1 ยท GPL-2.0-only
- debian trixie: alsa-utils 1.2.14-1 ยท GPL-2.0-only
- fedora 43: alsa-utils-alsabat 1.2.14-2.fc43 ยท GPL-2.0-or-later
- fedora 43: alsa-utils-alsabat 1.2.16-1.fc43 ยท GPL-2.0-or-later
- fedora 44: alsa-utils-alsabat 1.2.15.2-3.fc44 ยท GPL-2.0-or-later
- fedora 44: alsa-utils-alsabat 1.2.16-1.fc44 ยท GPL-2.0-or-later
- nixos 26.05: alsa-utils 1.2.14
- nixpkgs unstable: alsa-utils 1.2.16
- opensuse-leap 16.0: alsabat 1.2.14-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: alsabat 1.2.14-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: alsabat 1.2.14-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: alsabat 1.2.14-160000.2.2 ยท GPL-2.0-or-later
- ubuntu jammy: alsa-utils 1.2.6-1ubuntu1 ยท GPL-2.0-only
- ubuntu noble: alsa-utils 1.2.9-1ubuntu5 ยท GPL-2.0-only
- ubuntu questing: alsa-utils 1.2.14-1ubuntu1
- ubuntu resolute: alsa-utils 1.2.15.2-1ubuntu1 ยท GPL-2.0-only
- ubuntu stonking: alsa-utils 1.2.15.2-1ubuntu2 ยท GPL-2.0-only
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms