1ALSABAT(1)                  General Commands Manual                 ALSABAT(1)
2
3
4

NAME

6       alsabat - command-line sound tester for ALSA sound card driver
7
8

SYNOPSIS

10       alsabat [flags]
11
12

DESCRIPTION

14       ALSABAT(ALSA  Basic  Audio  Tester)  is  a  simple command-line utility
15       intended to help automate audio driver and sound  server  testing  with
16       little  human  interaction.  ALSABAT can be used to test audio quality,
17       stress test features and test audio before and after PM state changes.
18
19       ALSABAT's design is relatively simple. ALSABAT plays  an  audio  stream
20       and  captures  the same stream in either a digital or analog loop back.
21       It then compares the captured stream using a FFT  to  the  original  to
22       determine if the test case passes or fails.
23
24       ALSABAT  can  either  run  wholly  on  the  target machine being tested
25       (standalone mode) or can run as a client/server mode where  by  alsabat
26       client  runs  on  the  target and runs as a server on a separate tester
27       machine. The client/server mode still requires some manual  interaction
28       for  synchronization,  but  this is actively being developed for future
29       releases.
30
31       The hardware testing configuration may require the  use  of  an  analog
32       cable connecting target to tester machines or a cable to create an ana‐
33       log loopback if no loopback mode is not available on the sound hardware
34       that  is being tested.  An analog loopback cable can be used to connect
35       the "line in" to "line out" jacks to create a loopback. If  only  head‐
36       phone  and  mic  jacks (or combo jack) are available then the following
37       simple circuit can be used to create an analog loopback :-
38
39       https://source.android.com/devices/audio/loopback.html
40
41       If tinyalsa is installed in system, user can choose tinyalsa as backend
42       lib of alsabat, with configure option "--enable-alsabat-backend-tiny".
43
44

OPTIONS

46       -h, --help
47              Help: show syntax.
48
49       -D     Select sound card to be tested by name.
50
51       -P     Select the playback PCM device.
52
53       -C     Select the capture PCM device.
54
55       -f     Sample format
56              Recognized sample formats are: U8 S16_LE S24_3LE S32_LE
57              Some of these may not be available on selected hardware
58              The available format shortcuts are:
59              -f cd (16 bit little endian, 44100, stereo) [-f S16_LE -c2 -r44100]
60              -f dat (16 bit little endian, 48000, stereo) [-f S16_LE -c2 -r48000]
61              If no format is given S16_LE is used.
62
63       -c     The  number of channels. The default is one channel.  Valid val‐
64              ues at the moment are 1 or 2.
65
66       -r     Sampling rate in Hertz. The default rate is 44100 Hertz.   Valid
67              values depends on hardware support.
68
69       -n     Duration  of generated signal.  The value could be either of the
70              two forms:
71              1. Decimal integer, means number of frames;
72              2. Floating point with suffix 's', means number of seconds.
73              The default is 2 seconds.
74
75       -k     Sigma k value for analysis.
76              The analysis function reads data from WAV file, run FFT  against
77              the  data to get magnitude of frequency vectors, and then calcu‐
78              lates the average value and standard deviation of frequency vec‐
79              tors. After that, we define a threshold:
80              threshold = k * standard_deviation + mean_value
81              Frequencies  with amplitude larger than threshold will be recog‐
82              nized as a peak, and the frequency with largest peak value  will
83              be recognized as a detected frequency.
84              ALSABAT  then  compares  the  detected  frequency to target fre‐
85              quency, to decide if the detecting passes or fails.
86              The default value is 3.0.
87
88       -F     Target frequency for signal generation and analysis,  in  Hertz.
89              The default is 997.0 Hertz.  Valid range is (DC_THRESHOLD, 40% *
90              Sampling rate).
91
92       -p     Total number of periods to play or capture.
93
94       --log=#
95              Write stderr and stdout output to this log file.
96
97       --file=#
98              Input WAV file for playback.
99
100       --saveplay=#
101              Target WAV file to save capture test content.
102
103       --local
104              Internal loopback mode.  Playback, capture and analysis internal
105              to  ALSABAT  only.  This  is intended for developers to test new
106              ALSABAT features as no audio is routed outside of ALSABAT.
107
108       --standalone
109              Add support for standalone mode where ALSABAT will run on a dif‐
110              ferent machine to the one being tested.  In standalone mode, the
111              sound data can be generated, playback and captured just like  in
112              normal  mode, but will not be analyzed.  The ALSABAT being built
113              without libfftw3 support is  always  in  standalone  mode.   The
114              ALSABAT  in  normal  mode  can  also  bypass data analysis using
115              option "--standalone".
116
117       --roundtriplatency
118              Round trip latency test.  Audio latency is the time delay as  an
119              audio  signal  passes through a system.  There are many kinds of
120              audio latency metrics. One  useful  metric  is  the  round  trip
121              latency, which is the sum of output latency and input latency.
122
123       --snr-db=#
124              Noise  detection  threshold in SNR (dB). 26dB indicates 5% noise
125              in amplitude.  ALSABAT  will  return  error  if  signal  SNR  is
126              smaller than the threshold.
127
128       --snr-pc=#
129              Noise  detection threshold in percentage of noise amplitude (%).
130              ALSABAT will return error if the noise amplitude is larger  than
131              the threshold.
132
133

EXAMPLES

135       alsabat -P plughw:0,0 -C plughw:0,0 -c 2 -f S32_LE -F 250
136              Generate  and  play  a sine wave of 250 Hertz with 2 channel and
137              S32_LE format, and then capture and analyze.
138
139
140       alsabat -P plughw:0,0 -C plughw:0,0 --file 500Hz.wav
141              Play the RIFF WAV file  "500Hz.wav"  which  contains  500  Hertz
142              waveform LPCM data, and then capture and analyze.
143
144

RETURN VALUE

146       On success, returns 0.
147       If no peak be detected, returns -1001;
148       If only DC be detected, returns -1002;
149       If  peak  frequency  does  not match with the target frequency, returns
150       -1003.
151
152

SEE ALSO

154        aplay(1)
155
156

BUGS

158       Currently only support RIFF WAV format with PCM data. Please report any
159       bugs to the alsa-devel mailing list.
160
161

AUTHOR

163       alsabat  is by Liam Girdwood <liam.r.girdwood@linux.intel.com>, Bernard
164       Gautier  <bernard.gautier@intel.com>  and  Han  Lu  <han.lu@intel.com>.
165       This document is by Liam Girdwood <liam.r.girdwood@linux.intel.com> and
166       Han Lu <han.lu@intel.com>.
167
168
169
170                               20th October 2015                    ALSABAT(1)
Impressum