Skip to main content
Skip table of contents

Audio Front-End - C++

VDK features only one Audio Front End: VAFE.
The VAFE provides analysis tools to determine your audio quality and some basic filters to improve it.

Summary

Configuration

Here is a template that needs to be added in the vsdk.json configuration file to use VAFE:

JSON
{
    "vafe": {
      "afe": {
        "analyzers": {
            "first": { "type": "snr" },
            "second": { "type": "rt60", "bitspersample": 256 },
            "third": { "type": "mos", "model": "path_to_mos_model.json" }
        },
        "filters": {
            "filter1": { "type": "bandpass", "lowfrequency": 80, "highfrequency": 400 },
            "filter2": { "type": "lowpass", "frequency": 80 },
            "filter3": { "type": "highpass", "frequency": 400 }
        }
      }
    }
}

Everything needs to be specified in this configuration file to be loaded later in the C++ code.
Specifying a filter here does not mean that it will be loaded by default.

Includes

CPP
#include <vsdk/afe/vafe.hpp>

Creating an Analyzer

CPP
auto const snrAnalyzer = engine->makeAnalyzer(name);
snrAnalyzer->subscribe([] (Vsdk::Afe::Analyzer::Result const & r) { ... });
p.pushBackConsumer(snrAnalyzer);

Creating a Filter

CPP
auto const bandpassFilter = engine->makeFilter("filter1");
p.pushBackModifier(bandpassFilter);

Insertion Order

Multiple analyzers and filters can be registered. Order has an importance, especially the modifiers (here filters) as they are called sequentially. You can use various methods of inserting to control the order:

CPP
p.pushBackModifier(filter1);
auto it = p.pushBackModifier(filter3);
p.insertModifier(it, filter2); // inserts filter2 between 1 and 3

Analyzers

Every values are normalized in percentage, with 100% as best value possible. Three analyzers type are available:

Type

Meaning

Description

SNR

Signal-Noise Ratio

Representation of the distance between speech and noise into the signal.

RT60

Reverb-Time for 60dB

Algorithm used to evaluate echo present in the data.

MOS

Mean Opinion Score

Tries to evaluate audio as humans using machine learning.

Filters

For the moment, only simple pass filters are available. They will make audio above or under a frequency less audible.

Type

Parameters

Description

bandpass

"lowfrequency", "highfrequency"

Soften signal under and above frequencies specified.

lowpass

"frequency"

Soften data above specified frequency.

highpass

"frequency"

Soften data under specified frequency.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.