alsabat.1 (6035B)
1 .TH ALSABAT 1 "20th October 2015" 2 .SH NAME 3 alsabat \- command\-line sound tester for ALSA sound card driver 4 5 .SH SYNOPSIS 6 \fBalsabat\fP [\fIflags\fP] 7 8 .SH DESCRIPTION 9 \fBALSABAT(ALSA Basic Audio Tester)\fP is a simple command\-line utility 10 intended to help automate audio driver and sound server testing with little 11 human interaction. ALSABAT can be used to test audio quality, stress test 12 features and test audio before and after PM state changes. 13 14 ALSABAT's design is relatively simple. ALSABAT plays an audio stream and 15 captures the same stream in either a digital or analog loop back. It then 16 compares the captured stream using a FFT to the original to determine if 17 the test case passes or fails. 18 19 ALSABAT can either run wholly on the target machine being tested (standalone 20 mode) or can run as a client/server mode where by alsabat client runs on the 21 target and runs as a server on a separate tester machine. The client/server 22 mode still requires some manual interaction for synchronization, but this 23 is actively being developed for future releases. 24 25 The hardware testing configuration may require the use of an analog cable 26 connecting target to tester machines or a cable to create an analog 27 loopback if no loopback mode is not available on the sound hardware that 28 is being tested. 29 An analog loopback cable can be used to connect the "line in" to "line out" 30 jacks to create a loopback. If only headphone and mic jacks (or combo jack) 31 are available then the following simple circuit can be used to create an 32 analog loopback :- 33 34 https://source.android.com/devices/audio/loopback.html 35 36 If tinyalsa is installed in system, user can choose tinyalsa as backend lib 37 of alsabat, with configure option "--enable-alsabat-backend-tiny". 38 39 .SH OPTIONS 40 .TP 41 \fI\-h, \-\-help\fP 42 Help: show syntax. 43 .TP 44 \fI\-D\fP 45 Select sound card to be tested by name. 46 .TP 47 \fI\-P\fP 48 Select the playback PCM device. 49 .TP 50 \fI\-C\fP 51 Select the capture PCM device. 52 .TP 53 \fI\-f\fP 54 Sample format 55 .br 56 Recognized sample formats are: U8 S16_LE S24_3LE S32_LE 57 .br 58 Some of these may not be available on selected hardware 59 .br 60 The available format shortcuts are: 61 .nf 62 \-f cd (16 bit little endian, 44100, stereo) [\-f S16_LE \-c2 \-r44100] 63 \-f dat (16 bit little endian, 48000, stereo) [\-f S16_LE \-c2 \-r48000] 64 .fi 65 If no format is given S16_LE is used. 66 .TP 67 \fI\-c\fP 68 The number of channels. The default is one channel. 69 Valid values at the moment are 1 or 2. 70 .TP 71 \fI\-r\fP 72 Sampling rate in Hertz. The default rate is 44100 Hertz. 73 Valid values depends on hardware support. 74 .TP 75 \fI\-n\fP 76 Duration of generated signal. 77 The value could be either of the two forms: 78 .br 79 1. Decimal integer, means number of frames; 80 .br 81 2. Floating point with suffix 's', means number of seconds. 82 .br 83 The default is 2 seconds. 84 .TP 85 \fI\-k\fP 86 Sigma k value for analysis. 87 .br 88 The analysis function reads data from WAV file, run FFT against the data 89 to get magnitude of frequency vectors, and then calculates the average 90 value and standard deviation of frequency vectors. After that, we define 91 a threshold: 92 .br 93 threshold = k * standard_deviation + mean_value 94 .br 95 Frequencies with amplitude larger than threshold will be recognized as a 96 peak, and the frequency with largest peak value will be recognized as a 97 detected frequency. 98 .br 99 ALSABAT then compares the detected frequency to target frequency, to 100 decide if the detecting passes or fails. 101 .br 102 The default value is 3.0. 103 .TP 104 \fI\-F\fP 105 Target frequency for signal generation and analysis, in Hertz. 106 The default is 997.0 Hertz. 107 Valid range is (DC_THRESHOLD, 40% * Sampling rate). 108 .TP 109 \fI\-p\fP 110 Total number of periods to play or capture. 111 .TP 112 \fI\-\-log=#\fP 113 Write stderr and stdout output to this log file. 114 .TP 115 \fI\-\-file=#\fP 116 Input WAV file for playback. 117 .TP 118 \fI\-\-saveplay=#\fP 119 Target WAV file to save capture test content. 120 .TP 121 \fI\-\-local\fP 122 Internal loopback mode. 123 Playback, capture and analysis internal to ALSABAT only. This is intended 124 for developers to test new ALSABAT features as no audio is routed outside 125 of ALSABAT. 126 .TP 127 \fI\-\-standalone\fP 128 Add support for standalone mode where ALSABAT will run on a different machine 129 to the one being tested. 130 In standalone mode, the sound data can be generated, playback and captured 131 just like in normal mode, but will not be analyzed. 132 The ALSABAT being built without libfftw3 support is always in standalone mode. 133 The ALSABAT in normal mode can also bypass data analysis using option 134 "--standalone". 135 .TP 136 \fI\-\-roundtriplatency\fP 137 Round trip latency test. 138 Audio latency is the time delay as an audio signal passes through a system. 139 There are many kinds of audio latency metrics. One useful metric is the 140 round trip latency, which is the sum of output latency and input latency. 141 .TP 142 \fI\-\-snr\-db=#\fP 143 Noise detection threshold in SNR (dB). 26dB indicates 5% noise in amplitude. 144 ALSABAT will return error if signal SNR is smaller than the threshold. 145 .TP 146 \fI\-\-snr\-pc=#\fP 147 Noise detection threshold in percentage of noise amplitude (%). 148 ALSABAT will return error if the noise amplitude is larger than the threshold. 149 150 .SH EXAMPLES 151 152 .TP 153 \fBalsabat \-P plughw:0,0 \-C plughw:0,0 \-c 2 \-f S32_LE \-F 250\fR 154 Generate and play a sine wave of 250 Hertz with 2 channel and S32_LE format, 155 and then capture and analyze. 156 157 .TP 158 \fBalsabat \-P plughw:0,0 \-C plughw:0,0 \-\-file 500Hz.wav\fR 159 Play the RIFF WAV file "500Hz.wav" which contains 500 Hertz waveform LPCM 160 data, and then capture and analyze. 161 162 .SH RETURN VALUE 163 .br 164 On success, returns 0. 165 .br 166 If no peak be detected, returns -1001; 167 .br 168 If only DC be detected, returns -1002; 169 .br 170 If peak frequency does not match with the target frequency, returns -1003. 171 172 .SH SEE ALSO 173 \fB 174 aplay(1) 175 \fP 176 177 .SH BUGS 178 Currently only support RIFF WAV format with PCM data. Please report any bugs to 179 the alsa-devel mailing list. 180 181 .SH AUTHOR 182 \fBalsabat\fP is by Liam Girdwood <liam.r.girdwood@linux.intel.com>, Bernard 183 Gautier <bernard.gautier@intel.com> and Han Lu <han.lu@intel.com>. 184 This document is by Liam Girdwood <liam.r.girdwood@linux.intel.com> and Han Lu 185 <han.lu@intel.com>.