232 lines
7.8 KiB
HTML
232 lines
7.8 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of ALSABAT</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>ALSABAT</H1>
|
|
Section: User Commands (1)<BR>Updated: 20th October 2015<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
alsabat - command-line sound tester for ALSA sound card driver
|
|
<P>
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>alsabat</B> [<I>flags</I>]
|
|
<P>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>ALSABAT(ALSA Basic Audio Tester)</B> is a simple command-line utility
|
|
intended to help automate audio driver and sound server testing with little
|
|
human interaction. ALSABAT can be used to test audio quality, stress test
|
|
features and test audio before and after PM state changes.
|
|
<P>
|
|
ALSABAT's design is relatively simple. ALSABAT plays an audio stream and
|
|
captures the same stream in either a digital or analog loop back. It then
|
|
compares the captured stream using a FFT to the original to determine if
|
|
the test case passes or fails.
|
|
<P>
|
|
ALSABAT can either run wholly on the target machine being tested (standalone
|
|
mode) or can run as a client/server mode where by alsabat client runs on the
|
|
target and runs as a server on a separate tester machine. The client/server
|
|
mode still requires some manual interaction for synchronization, but this
|
|
is actively being developed for future releases.
|
|
<P>
|
|
The hardware testing configuration may require the use of an analog cable
|
|
connecting target to tester machines or a cable to create an analog
|
|
loopback if no loopback mode is not available on the sound hardware that
|
|
is being tested.
|
|
An analog loopback cable can be used to connect the "line in" to "line out"
|
|
jacks to create a loopback. If only headphone and mic jacks (or combo jack)
|
|
are available then the following simple circuit can be used to create an
|
|
analog loopback :-
|
|
<P>
|
|
<A HREF="https://source.android.com/devices/audio/loopback.html">https://source.android.com/devices/audio/loopback.html</A>
|
|
<P>
|
|
If tinyalsa is installed in system, user can choose tinyalsa as backend lib
|
|
of alsabat, with configure option "--enable-alsabat-backend-tiny".
|
|
<P>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><I>-h, --help</I><DD>
|
|
Help: show syntax.
|
|
<DT id="2"><I>-D</I><DD>
|
|
Select sound card to be tested by name.
|
|
<DT id="3"><I>-P</I><DD>
|
|
Select the playback PCM device.
|
|
<DT id="4"><I>-C</I><DD>
|
|
Select the capture PCM device.
|
|
<DT id="5"><I>-f</I><DD>
|
|
Sample format
|
|
<BR>
|
|
|
|
Recognized sample formats are: U8 S16_LE S24_3LE S32_LE
|
|
<BR>
|
|
|
|
Some of these may not be available on selected hardware
|
|
<BR>
|
|
|
|
The available format shortcuts are:
|
|
<PRE>
|
|
-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]
|
|
</PRE>
|
|
|
|
If no format is given S16_LE is used.
|
|
<DT id="6"><I>-c</I><DD>
|
|
The number of channels. The default is one channel.
|
|
Valid values at the moment are 1 or 2.
|
|
<DT id="7"><I>-r</I><DD>
|
|
Sampling rate in Hertz. The default rate is 44100 Hertz.
|
|
Valid values depends on hardware support.
|
|
<DT id="8"><I>-n</I><DD>
|
|
Duration of generated signal.
|
|
The value could be either of the two forms:
|
|
<BR>
|
|
|
|
1. Decimal integer, means number of frames;
|
|
<BR>
|
|
|
|
2. Floating point with suffix 's', means number of seconds.
|
|
<BR>
|
|
|
|
The default is 2 seconds.
|
|
<DT id="9"><I>-k</I><DD>
|
|
Sigma k value for analysis.
|
|
<BR>
|
|
|
|
The analysis function reads data from WAV file, run FFT against the data
|
|
to get magnitude of frequency vectors, and then calculates the average
|
|
value and standard deviation of frequency vectors. After that, we define
|
|
a threshold:
|
|
<BR>
|
|
|
|
threshold = k * standard_deviation + mean_value
|
|
<BR>
|
|
|
|
Frequencies with amplitude larger than threshold will be recognized as a
|
|
peak, and the frequency with largest peak value will be recognized as a
|
|
detected frequency.
|
|
<BR>
|
|
|
|
ALSABAT then compares the detected frequency to target frequency, to
|
|
decide if the detecting passes or fails.
|
|
<BR>
|
|
|
|
The default value is 3.0.
|
|
<DT id="10"><I>-F</I><DD>
|
|
Target frequency for signal generation and analysis, in Hertz.
|
|
The default is 997.0 Hertz.
|
|
Valid range is (DC_THRESHOLD, 40% * Sampling rate).
|
|
<DT id="11"><I>-p</I><DD>
|
|
Total number of periods to play or capture.
|
|
<DT id="12"><I>--log=#</I><DD>
|
|
Write stderr and stdout output to this log file.
|
|
<DT id="13"><I>--file=#</I><DD>
|
|
Input WAV file for playback.
|
|
<DT id="14"><I>--saveplay=#</I><DD>
|
|
Target WAV file to save capture test content.
|
|
<DT id="15"><I>--local</I><DD>
|
|
Internal loopback mode.
|
|
Playback, capture and analysis internal to ALSABAT only. This is intended
|
|
for developers to test new ALSABAT features as no audio is routed outside
|
|
of ALSABAT.
|
|
<DT id="16"><I>--standalone</I><DD>
|
|
Add support for standalone mode where ALSABAT will run on a different machine
|
|
to the one being tested.
|
|
In standalone mode, the sound data can be generated, playback and captured
|
|
just like in normal mode, but will not be analyzed.
|
|
The ALSABAT being built without libfftw3 support is always in standalone mode.
|
|
The ALSABAT in normal mode can also bypass data analysis using option
|
|
"--standalone".
|
|
<DT id="17"><I>--roundtriplatency</I><DD>
|
|
Round trip latency test.
|
|
Audio latency is the time delay as an audio signal passes through a system.
|
|
There are many kinds of audio latency metrics. One useful metric is the
|
|
round trip latency, which is the sum of output latency and input latency.
|
|
<DT id="18"><I>--snr-db=#</I><DD>
|
|
Noise detection threshold in SNR (dB). 26dB indicates 5% noise in amplitude.
|
|
ALSABAT will return error if signal SNR is smaller than the threshold.
|
|
<DT id="19"><I>--snr-pc=#</I><DD>
|
|
Noise detection threshold in percentage of noise amplitude (%).
|
|
ALSABAT will return error if the noise amplitude is larger than the threshold.
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<P>
|
|
<DL COMPACT>
|
|
<DT id="20"><B>alsabat -P plughw:0,0 -C plughw:0,0 -c 2 -f S32_LE -F 250</B><DD>
|
|
Generate and play a sine wave of 250 Hertz with 2 channel and S32_LE format,
|
|
and then capture and analyze.
|
|
<P>
|
|
<DT id="21"><B>alsabat -P plughw:0,0 -C plughw:0,0 --file 500Hz.wav</B><DD>
|
|
Play the RIFF WAV file "500Hz.wav" which contains 500 Hertz waveform LPCM
|
|
data, and then capture and analyze.
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
<BR>
|
|
|
|
On success, returns 0.
|
|
<BR>
|
|
|
|
If no peak be detected, returns -1001;
|
|
<BR>
|
|
|
|
If only DC be detected, returns -1002;
|
|
<BR>
|
|
|
|
If peak frequency does not match with the target frequency, returns -1003.
|
|
<P>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B>
|
|
<A HREF="/cgi-bin/man/man2html?1+aplay">aplay</A>(1)
|
|
</B>
|
|
<P>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
Currently only support RIFF WAV format with PCM data. Please report any bugs to
|
|
the alsa-devel mailing list.
|
|
<P>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
<B>alsabat</B> is by Liam Girdwood <<A HREF="mailto:liam.r.girdwood@linux.intel.com">liam.r.girdwood@linux.intel.com</A>>, Bernard
|
|
Gautier <<A HREF="mailto:bernard.gautier@intel.com">bernard.gautier@intel.com</A>> and Han Lu <<A HREF="mailto:han.lu@intel.com">han.lu@intel.com</A>>.
|
|
This document is by Liam Girdwood <<A HREF="mailto:liam.r.girdwood@linux.intel.com">liam.r.girdwood@linux.intel.com</A>> and Han Lu
|
|
<<A HREF="mailto:han.lu@intel.com">han.lu@intel.com</A>>.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="22"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="23"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="24"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="25"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="26"><A HREF="#lbAF">EXAMPLES</A><DD>
|
|
<DT id="27"><A HREF="#lbAG">RETURN VALUE</A><DD>
|
|
<DT id="28"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
<DT id="29"><A HREF="#lbAI">BUGS</A><DD>
|
|
<DT id="30"><A HREF="#lbAJ">AUTHOR</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:06 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|