11.. _build-testbench :
22
3- Build Testbench and do first run
4- ################################
3+ Build and Run Testbench
4+ #######################
55
6- The firmware sources need to be retrieved from the thesofproject
7- repository in Github as described in :ref: `build-from-scratch `. A
8- shell need to be started at the firmware repository top level in
9- directory "$SOF_WORKSPACE"/sof as described there.
6+ Retrieve the required firmware from the ``thesofproject `` repository in
7+ Github as described in :ref: `build-from-scratch `. Start a shell at the
8+ firmware repository top level in the ``$SOF_WORKSPACE/sof `` directory as also described.
109
1110.. code-block :: bash
1211
1312 cd " $SOF_WORKSPACE " /sof
1413
15- Run the following scripts to build the test pipelines, build the
16- testbench, and run testbench with the provided quick check script.
14+ Run the following scripts to build the test pipelines, build the testbench,
15+ and run the testbench with the provided quick check script:
1716
1817.. code-block :: bash
1918
2019 ./scripts/build-tools.sh -t
2120 ./scripts/rebuild-testbench.sh
2221 ./scripts/host-testbench.sh
2322
24- The current version of host-testbench.sh outputs this text if the
25- previous steps were successful.
23+ The current version of `` host-testbench.sh `` outputs the following text if
24+ the previous steps are successful:
2625
2726::
2827
@@ -39,80 +38,82 @@ previous steps were successful.
3938 eqiir test passed!
4039 eqiir_out size check passed!
4140
42- In the future there will be more items tested in this check so
43- the output will likely change. If this worked the testbench can be used
44- for audio quality tests and debugging new components under development.
41+ Note that more items are slated to be tested in this check so the output
42+ will likely change. The testbench can be used for audio quality tests and
43+ debugging new components under development.
4544
46- When examining script host-testbench.sh it is seen that e.g. the IIR EQ
47- test is run with commands
45+ host-testbench.sh
46+ =================
47+
48+ In our example, the ``host-testbench.sh `` script shows that the IIR EQ test
49+ is run with the following commands:
4850
4951.. code-block :: bash
5052
5153 cd tools/test/audio
5254 head -c 10240 < /dev/zero > zeros_in.raw
5355 ./eqiir_run.sh 16 16 48000 zeros_in.raw eqiir_out.raw
5456
55- The directory with eqiir_run.sh is entered first. Then a file of 10240
56- bytes of zeros is created. As 16 bit data it corresponds to 2560
57- frames of S16_LE format stereo frames (4 bytes per frame). At 48 kHz
58- rate it corresponds to 5.3 ms of audio stream. Audio test signals are
59- usually longer but this was sufficient for the quick testbench health check.
60-
61- To process e.g. a music file with a under-development SOF component an
62- utility to convert from wav, mp3, etc. to raw S16_LE/S24_LE/S32_LE
63- format is needed. The next command installs from Ubuntu packages
64- repository a bunch of useful tools for audio files converting,
65- viewing, recording, playing, and editing. FFMPEG can be used to
66- import/export formats that the simpler tools sox and ecasound do not
67- support. The last three items are light audio waveform viewers and
68- players with some editing and mixing capabilities. Also digital audio
69- workstation (DAW) software such as Ardour, Qtractor, and MusE can be
70- used but there's more effort in using them for small quick tasks such
71- as the following case.
57+ The directory that contains ``eqiir_run.sh `` is entered first. Next, a file
58+ of 10240 bytes of zeros is created. As 16-bit data, it corresponds to 2560
59+ frames of S16_LE format stereo frames (4 bytes per frame). At a 48 kHz rate,
60+ it corresponds to 5.3 ms of audio stream. Audio test signals are usually
61+ longer but this is sufficient for the quick testbench health check.
62+
63+ To process a music file with an under-development SOF component, a utility
64+ to convert from wav, mp3, etc. to raw S16_LE/S24_LE/S32_LE format is needed.
65+ The next command installs from the Ubuntu packages repository a lot of useful
66+ tools for audio files converting, viewing, recording, playing, and editing.
67+ FFMPEG can be used to import/export formats that the simpler tools ``sox ``
68+ and ``ecasound `` do not support. The last three items are light audio
69+ waveform viewers and players with some editing and mixing capabilities.
70+ Also, digital audio workstation (DAW) software such as Ardour, Qtractor, and
71+ MusE can be used but there's more effort in using them for small quick tasks
72+ such as in the following case.
7273
7374.. code-block :: bash
7475
7576 sudo apt install alsa-utils pulseaudio-utils sox ecasound ffmpeg audacity snd-gtk-pulse mhwaveedit
7677
77- A sample music or voice or test signal file is needed. The above
78- alsa-utils package contains some wav files. The sound (and many other
79- file types) characteristics can be checked with file command easily.
78+ A sample music or voice or test signal file is needed. The above alsa-utils
79+ package contains some wav files. The sound (and many other file types)
80+ characteristics can be easily checked using this file command:
8081
8182.. code-block :: bash
8283
8384 $ file /usr/share/sounds/alsa/Front_Center.wav
8485 /usr/share/sounds/alsa/Front_Center.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 48000 Hz
8586
86- This file has the correct default 48 kHz rate and 16 bits samples but
87- it is single channel format (mono). To fix it for test run this
88- example command for sox automatically converts the sample format to
89- stereo by duplicating the channels. Also the rate would be converted
90- if the file would be e.g. 44100 Hz sampled.
87+ This file has the correct default 48 kHz rate and 16 bits samples but it is
88+ in a single channel format (mono). To fix it for testing, run the following
89+ example command. Sox automatically converts the sample format to stereo by
90+ duplicating the channels. Also the rate would be converted if the file would
91+ be 44100 Hz sampled.
9192
9293.. code-block :: bash
9394
9495 sox /usr/share/sounds/alsa/Front_Center.wav --encoding signed-integer -L -r 48000 -c 2 -b 16 audio_in.raw
9596
96- Now the testbench can be executed for the input file and the output
97- can be converted back to wav format.
97+ Now the testbench can be executed for the input file and the output can be
98+ converted back to wav format:
9899
99100.. code-block :: bash
100101
101102 ./eqiir_run.sh 16 16 48000 audio_in.raw audio_out.raw
102103 sox --encoding signed-integer -L -r 48000 -c 2 -b 16 audio_out.raw audio_out.wav
103104
104- The file can be played from command line with command or launched to
105- an audio editor tool, e.g. mhWaveEdit.
105+ The file can be played from the command line with the following command or
106+ it can be launched to an audio editor tool such as mhWaveEdit:
106107
107108.. code-block :: bash
108109
109110 paplay audio_out.wav
110111 mhWaveEdit audio_out.wav
111112
112113 .. figure :: fig_mhwaveedit.png
113-
114+
114115 Viewing the result with mhWaveEdit
115116
116- Find the green play symbol from tools icons row to play the clip in
117- the application. You can also zoom with mouse to audio waveform
118- details. The Yellow play symbol plays a mouse button 1 selected area.
117+ Select the green ** play ** icon to play the clip in the application. Use the
118+ mouse to zoom in on audio waveform details. Select the yellow ** play ** icon
119+ to play a selected area.
0 commit comments