Blame bat/alsabat.1

Packit 229ac0
.TH ALSABAT 1 "20th October 2015"
Packit 229ac0
.SH NAME
Packit 229ac0
alsabat \- command\-line sound tester for ALSA sound card driver
Packit 229ac0
Packit 229ac0
.SH SYNOPSIS
Packit 229ac0
\fBalsabat\fP [\fIflags\fP]
Packit 229ac0
Packit 229ac0
.SH DESCRIPTION
Packit 229ac0
\fBALSABAT(ALSA Basic Audio Tester)\fP is a simple command\-line utility
Packit 229ac0
intended to help automate audio driver and sound server testing with little
Packit 229ac0
human interaction. ALSABAT can be used to test audio quality, stress test
Packit 229ac0
features and test audio before and after PM state changes.
Packit 229ac0
Packit 229ac0
ALSABAT's design is relatively simple. ALSABAT plays an audio stream and
Packit 229ac0
captures the same stream in either a digital or analog loop back. It then
Packit 229ac0
compares the captured stream using a FFT to the original to determine if
Packit 229ac0
the test case passes or fails.
Packit 229ac0
Packit 229ac0
ALSABAT can either run wholly on the target machine being tested (standalone
Packit 229ac0
mode) or can run as a client/server mode where by alsabat client runs on the
Packit 229ac0
target and runs as a server on a separate tester machine. The client/server
Packit 229ac0
mode still requires some manual interaction for synchronization, but this
Packit 229ac0
is actively being developed for future releases.
Packit 229ac0
Packit 229ac0
The hardware testing configuration may require the use of an analog cable
Packit 229ac0
connecting target to tester machines or a cable to create an analog
Packit 229ac0
loopback if no loopback mode is not available on the sound hardware that
Packit 229ac0
is being tested.
Packit 229ac0
An analog loopback cable can be used to connect the "line in" to "line out"
Packit 229ac0
jacks to create a loopback. If only headphone and mic jacks (or combo jack)
Packit 229ac0
are available then the following simple circuit can be used to create an
Packit 229ac0
analog loopback :-
Packit 229ac0
Packit 229ac0
https://source.android.com/devices/audio/loopback.html
Packit 229ac0
Packit 229ac0
If tinyalsa is installed in system, user can choose tinyalsa as backend lib
Packit 229ac0
of alsabat, with configure option "--enable-alsabat-backend-tiny".
Packit 229ac0
Packit 229ac0
.SH OPTIONS
Packit 229ac0
.TP
Packit 229ac0
\fI\-h, \-\-help\fP
Packit 229ac0
Help: show syntax.
Packit 229ac0
.TP
Packit 229ac0
\fI\-D\fP
Packit 229ac0
Select sound card to be tested by name.
Packit 229ac0
.TP
Packit 229ac0
\fI\-P\fP
Packit 229ac0
Select the playback PCM device.
Packit 229ac0
.TP
Packit 229ac0
\fI\-C\fP
Packit 229ac0
Select the capture PCM device.
Packit 229ac0
.TP
Packit 229ac0
\fI\-f\fP
Packit 229ac0
Sample format
Packit 229ac0
.br
Packit 229ac0
Recognized sample formats are: U8 S16_LE S24_3LE S32_LE
Packit 229ac0
.br
Packit 229ac0
Some of these may not be available on selected hardware
Packit 229ac0
.br
Packit 229ac0
The available format shortcuts are:
Packit 229ac0
.nf
Packit 229ac0
\-f cd (16 bit little endian, 44100, stereo) [\-f S16_LE \-c2 \-r44100]
Packit 229ac0
\-f dat (16 bit little endian, 48000, stereo) [\-f S16_LE \-c2 \-r48000]
Packit 229ac0
.fi
Packit 229ac0
If no format is given S16_LE is used.
Packit 229ac0
.TP
Packit 229ac0
\fI\-c\fP
Packit 229ac0
The number of channels. The default is one channel.
Packit 229ac0
Valid values at the moment are 1 or 2.
Packit 229ac0
.TP
Packit 229ac0
\fI\-r\fP
Packit 229ac0
Sampling rate in Hertz. The default rate is 44100 Hertz.
Packit 229ac0
Valid values depends on hardware support.
Packit 229ac0
.TP
Packit 229ac0
\fI\-n\fP
Packit 229ac0
Duration of generated signal.
Packit 229ac0
The value could be either of the two forms:
Packit 229ac0
.br
Packit 229ac0
1. Decimal integer, means number of frames;
Packit 229ac0
.br
Packit 229ac0
2. Floating point with suffix 's', means number of seconds.
Packit 229ac0
.br
Packit 229ac0
The default is 2 seconds.
Packit 229ac0
.TP
Packit 229ac0
\fI\-k\fP
Packit 229ac0
Sigma k value for analysis.
Packit 229ac0
.br
Packit 229ac0
The analysis function reads data from WAV file, run FFT against the data
Packit 229ac0
to get magnitude of frequency vectors, and then calculates the average
Packit 229ac0
value and standard deviation of frequency vectors. After that, we define
Packit 229ac0
a threshold:
Packit 229ac0
.br
Packit 229ac0
threshold = k * standard_deviation + mean_value
Packit 229ac0
.br
Packit 229ac0
Frequencies with amplitude larger than threshold will be recognized as a
Packit 229ac0
peak, and the frequency with largest peak value will be recognized as a
Packit 229ac0
detected frequency.
Packit 229ac0
.br
Packit 229ac0
ALSABAT then compares the detected frequency to target frequency, to
Packit 229ac0
decide if the detecting passes or fails.
Packit 229ac0
.br
Packit 229ac0
The default value is 3.0.
Packit 229ac0
.TP
Packit 229ac0
\fI\-F\fP
Packit 229ac0
Target frequency for signal generation and analysis, in Hertz.
Packit 229ac0
The default is 997.0 Hertz.
Packit 229ac0
Valid range is (DC_THRESHOLD, 40% * Sampling rate).
Packit 229ac0
.TP
Packit 229ac0
\fI\-p\fP
Packit 229ac0
Total number of periods to play or capture.
Packit 229ac0
.TP
Packit 229ac0
\fI\-\-log=#\fP
Packit 229ac0
Write stderr and stdout output to this log file.
Packit 229ac0
.TP
Packit 229ac0
\fI\-\-file=#\fP
Packit 229ac0
Input WAV file for playback.
Packit 229ac0
.TP
Packit 229ac0
\fI\-\-saveplay=#\fP
Packit 229ac0
Target WAV file to save capture test content.
Packit 229ac0
.TP
Packit 229ac0
\fI\-\-local\fP
Packit 229ac0
Internal loopback mode.
Packit 229ac0
Playback, capture and analysis internal to ALSABAT only. This is intended
Packit 229ac0
for developers to test new ALSABAT features as no audio is routed outside
Packit 229ac0
of ALSABAT.
Packit 229ac0
.TP
Packit 229ac0
\fI\-\-standalone\fP
Packit 229ac0
Add support for standalone mode where ALSABAT will run on a different machine
Packit 229ac0
to the one being tested.
Packit 229ac0
In standalone mode, the sound data can be generated, playback and captured
Packit 229ac0
just like in normal mode, but will not be analyzed.
Packit 229ac0
The ALSABAT being built without libfftw3 support is always in standalone mode.
Packit 229ac0
The ALSABAT in normal mode can also bypass data analysis using option
Packit 229ac0
"--standalone".
Packit 229ac0
.TP
Packit 229ac0
\fI\-\-roundtriplatency\fP
Packit 229ac0
Round trip latency test.
Packit 229ac0
Audio latency is the time delay as an audio signal passes through a system.
Packit 229ac0
There are many kinds of audio latency metrics. One useful metric is the
Packit 229ac0
round trip latency, which is the sum of output latency and input latency.
Packit 229ac0
.TP
Packit 229ac0
\fI\-\-snr\-db=#\fP
Packit 229ac0
Noise detection threshold in SNR (dB). 26dB indicates 5% noise in amplitude.
Packit 229ac0
ALSABAT will return error if signal SNR is smaller than the threshold.
Packit 229ac0
.TP
Packit 229ac0
\fI\-\-snr\-pc=#\fP
Packit 229ac0
Noise detection threshold in percentage of noise amplitude (%).
Packit 229ac0
ALSABAT will return error if the noise amplitude is larger than the threshold.
Packit 229ac0
Packit 229ac0
.SH EXAMPLES
Packit 229ac0
Packit 229ac0
.TP
Packit 229ac0
\fBalsabat \-P plughw:0,0 \-C plughw:0,0 \-c 2 \-f S32_LE \-F 250\fR
Packit 229ac0
Generate and play a sine wave of 250 Hertz with 2 channel and S32_LE format,
Packit 229ac0
and then capture and analyze.
Packit 229ac0
Packit 229ac0
.TP
Packit 229ac0
\fBalsabat \-P plughw:0,0 \-C plughw:0,0 \-\-file 500Hz.wav\fR
Packit 229ac0
Play the RIFF WAV file "500Hz.wav" which contains 500 Hertz waveform LPCM
Packit 229ac0
data, and then capture and analyze.
Packit 229ac0
Packit 229ac0
.SH RETURN VALUE
Packit 229ac0
.br
Packit 229ac0
On success, returns 0.
Packit 229ac0
.br
Packit 229ac0
If no peak be detected, returns -1001;
Packit 229ac0
.br
Packit 229ac0
If only DC be detected, returns -1002;
Packit 229ac0
.br
Packit 229ac0
If peak frequency does not match with the target frequency, returns -1003.
Packit 229ac0
Packit 229ac0
.SH SEE ALSO
Packit 229ac0
\fB
Packit 229ac0
aplay(1)
Packit 229ac0
\fP
Packit 229ac0
Packit 229ac0
.SH BUGS
Packit 229ac0
Currently only support RIFF WAV format with PCM data. Please report any bugs to
Packit 229ac0
the alsa-devel mailing list.
Packit 229ac0
Packit 229ac0
.SH AUTHOR
Packit 229ac0
\fBalsabat\fP is by Liam Girdwood <liam.r.girdwood@linux.intel.com>, Bernard
Packit 229ac0
Gautier <bernard.gautier@intel.com> and Han Lu <han.lu@intel.com>.
Packit 229ac0
This document is by Liam Girdwood <liam.r.girdwood@linux.intel.com> and Han Lu
Packit 229ac0
<han.lu@intel.com>.