agc#

This example demonstrates how AGC functions are called on a single thread to process data through the AGC stage of a pipeline. A single AGC instance is run using the profile that is tuned for communication with a human listener.

Since this example application only demonstrates the AGC module, without a VNR or an AEC, adaption based on voice activity and the loss control feature are both disabled.

The input is a single channel, 32-bit wav file, which is read and processed through the AGC frame-by-frame.

Building#

Run the following commands in the fwk_voice/build folder to build the firmware for the XCORE-AI-EXPLORER board as a target:

cmake --toolchain ../xmos_cmake_toolchain/xs3a.cmake ..
make fwk_voice_example_bare_metal_agc
# make sure you have the patch command available
cmake -G "Ninja" --toolchain  ../xmos_cmake_toolchain/xs3a.cmake ..
ninja fwk_voice_example_bare_metal_agc

It is highly recommended to use Ninja as the make system under Windows. Not only has Ninja been observed to be faster than MSVC nmake, it also works around an XMOS tools bug where certain path names may cause an issue with the XMOS compiler under Windows. This firmware has been tested with Ninja version v1.11.1.

To install Ninja, follow these steps:

  • Download ninja.exe from the Ninja release page and save to a suitable location such as C:\Program Files\ninja.

  • Ensure Ninja is on the command line path. It may be added to the system path using the following command: set PATH=%PATH%;C:\Program Files\ninja. This will work for the lifetime of the current command prompt.

  • The Ninja path may be permanently added to the system path using setx (use with caution) or via the Windows GUI: Control panel -> Advanced system settings -> Environment variables -> System variables -> Path

The correct installation of Ninja can be tested by typing ninja under an XTC Tools Command Prompt. The following error will be seen verifying that Ninja is correctly on the path but run from a directory not containing any document source files:

ninja: error: loading 'build.ninja': The system cannot find the file specified.

Running#

From the fwk_voice/build folder run:

pip install -e fwk_voice_deps/xscope_fileio
cd ../examples/bare-metal/agc
python ../shared_src/python/run_xcoreai.py ../../../build/examples/bare-metal/agc/bin/fwk_voice_example_bare_metal_agc.xe --input ../shared_src/test_streams/agc_example_input.wav
pip install -e fwk_voice_deps/xscope_fileio
cd fwk_voice_deps/xscope_fileio/host
cmake -G "Ninja" .
ninja
cd ../../../../examples/bare-metal/agc
python ../shared_src/python/run_xcoreai.py ../../../build/examples/bare-metal/agc/bin/fwk_voice_example_bare_metal_agc.xe --input ../shared_src/test_streams/agc_example_input.wav

Output#

The output file output.wav is generated in the fwk_voice/examples/bare-metal/agc directory. The provided input agc_example_input.wav is low-volume white-noise and the effect of the AGC can be heard in the output by listening to the two wav files.