1SOF audio quality test scripts
2
31. Introduction
4
5The purpose of the script is to test playback (and/or recording
6quality of a SOF platform with help of PC with a high quality USB
7sound card. Or in other words a sound card with sufficient number of
8analog inputs and outputs with sufficient signal levels handling
9capability, and good analog signal quality. The sound card should be
10better than expected quality of the SOF device.
11
12+------+                                      +--------+
13|      |<--- Ethernet or WLAN connection ---->|        |
14|  PC  |             +-------+                | SOF    |
15|      |<--- usb --->| Sound |--- line in --->| device |
16+------+             | card  |<-- line out ---|        |
17	  	     +-------+                +--------+
18
19The tests can also use digital interfaces like S/PDIF if available in
20the SOF device. That helps to move testing focus to smaller digital
21signal processing issues instead of usually dominant ADC/DAC
22performance (unless there's a major quality issue).
23
24The key tests to execute to quickly verify playback/recording audio
25quality are gain, frequency response (FR), and total harmonic
26distortion plus noise (THD+N). The test procedure and results reporting
27tries to follow AES17 recommendations.
28
29This work can be taken as a inexpensive introduction to objective
30audio quality parameters testing that should be useful for individual
31developers without access to professional test equipment for relative
32performance indicators testing. Tests like THD+N also work for
33automatic testing needs to quickly flag regressions in playback audio
34integrity.
35
36IMPORTANT NOTE: These test scripts are not calibrated and not suitable
37to produce absolute metric. The results will vary depending on the
38used sound card and depend on correctly done preparations on the
39PC. Therefore for professional usage with need for industry comparable
40metric we recommend instead dedicated test systems and services.
41
42
432. General preparations
44
45The PC should be installed with a Linux distribution that provides
46octave and octave-signal packaces or use commercial Matlab (R)
47software. For Octave it's recommended to use an initialization script
48that loads the needed packages and disables the pager to freely scroll
49the test text printings without frequently stopping to press <space>
50to proceed.
51
52$ sudo apt-get install octave octave-signal octave-io
53
54$ cat ~/.octaverc
55more off
56pkg load signal
57pkg load io
58
59The SOF device should be made accessible via ssh without
60password. Also the test user should belong to group audio in both PC
61and SOF device.
62
63To avoid including the PC audio server and it's signal processing into
64the test chain it is recommended to disable audio servers like
65pulseaudio permanently (rename the executable /usr/bin/pulseaudio) on
66the test PC and use the ALSA provided sound devices directly.
67
68There is need to go trough the alsamixer settings for the sound card
69and store them persistently. Also on sophisticated sound cards need to
70do internal settings via front panel or dedicated control SW for
71settings those are not exposed to alsamixer.
72
73
743. Playback and recording test preparations
75
76See script sof_audio_quality_test_config.m. It is a template to
77configure the audio interfaces for test playback and capture of the
78playback. Make a copy of the file for your test setup and edit the
79script sof_audio_quality_test_top.m to use that configuration script
80instead of the default. See line
81
82configs = {'sof_audio_quality_test_config.m'};
83
84The line initializes a cell array of strings. Multiple test
85configurations are added to cell array with comma as separator.
86
87To test playback of SOF device there's need to edit "play.user" to
88correpond to actual test user and hostname or IP address of the
89device. Also edit the "play.dev" to contain the audio playback device
90to test.
91
92For playabck capture to PC edit the "rec.dev", "rec.sft", "rec.nch",
93and "rec.ch" fields. The example is set for a 8ch sound card with SOF
94device connected into analog inputs 1 and 2.
95
96The setting "test.att_rec_db" is important. There must be a sufficient
97analog signal headroom for the sound card ADC to capture SOF DAC
98playback signal without clipping distortion. The example assumes 3 dB
99attenuation but it can be adjusted to be e.g. within 1 - 6 dB.
100
101You can start with 3 dB and run the test script
102sof_audio_quality_test.sh. It won't proceed if the gain test is not
103passing. Based on the reported difference vs. expected 0 dB gain
104adjust the alsamixer settings for you USB sound card capture gain. The
105controls may be also in the front panel.
106
107If the result still deviates from 0 dB and it's known that the
108playback level is correct it is possible to to adjust this attenuation
109parameter to get the 0 dB result.
110
1114. Tests reporting
112
113The script is configured to proceed without opening plot windows to
114desktop. Once the gain test is passed the script executes the FR and
115THD+N tests.
116
117The shell window will show a brief test report and the same will
118appear to directory "reports" with name prefix defined in "test.id" in
119the configuration file.
120
121The plots in PNG format are exported to directory "plots".
122
123That's all, happy testing!!
124