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