AudioFeatureGenerator Python Wrapper

This is a C++ Python wrapper that allows for executing the Gecko SDK AudioFeatureGenerator component from a Python script.

This is useful as it allows for using the exact same spectrogram generation algorithms between the Python model training scripts and embedded device at runtime.

This wrapper is made accessible to a Python script via the AudioFeatureGenerator python API. This Python API loads the C++ Python wrapper shared library into the Python runtime.

Refer to the AudioFeatureGenerator documentation for more details

Source Code

  • Python wrapper - This makes the AudioFeatureGenerator C++ library accessible to Python

  • C++ library - The C++ library, this invokes the Microfrontend to generate spectrograms

  • Microfrontend - Google-provided audio processing library to generate spectrograms

  • Python API - Python package that loads this C++ wrapper

Building the Wrapper


This wrapper comes pre-built when installing the MLTK Python package, e.g.:

pip install silabs-mltk

Automatic Build

This wrapper is automatically built when installing from source, e.g.:

git clone
cd mltk
pip install -e .

Manual build via MLTK command

To manually build this wrapper, issue the MLTK command:

mltk build audio_feature_generator_wrapper

Manual build via CMake

This wrapper can also be built via CMake using Visual Studio Code or the Command Line.

To build the wrapper, the build_options.cmake file needs to be modified.

Create the file <mltk repo root>/user_options.cmake and add:

mltk_set(MLTK_TARGET mltk_audio_feature_generator_wrapper)


You must remove this option and clean the build directory before building the example applications

Then configure the CMake project using the Window/Linux GCC toolchain and build the target: mltk_audio_feature_generator_wrapper.