Skip to main content
ai-coustics provides a C++11 wrapper around the native C SDK. This page pins the wrapper and native library to 0.24.0. Use the C++ API reference for types, methods, ownership and errors. The released header provides the wrapper declarations and inline implementation.

Installation

Use a C++11 compiler, Git and CMake 3.24 or later on a supported platform. On Windows, use a Visual Studio developer terminal with the C++ build tools installed. Create an empty project directory:
The CMake project below pins the C++ wrapper to 0.24.0. On the first configure, it downloads the matching native C SDK and checks its checksum. The example links the native SDK statically; network access is needed during configuration.

Quickstart

Prepare the key, model and input

Generate an SDK key on the developer platform. Set it in the terminal where you will run the program. Keep it out of source control and shared logs.
Replace YOUR_SDK_KEY with your key. This pins a format-7 build of quail-vf-2.2-l-16khz. Quail Voice Focus isolates the primary speaker for speech-to-text (STT) input. Downloading the model in advance does not remove SDK key authorization requirements; see authentication. Download the noisy speech fixture and save it as input.wav in this project directory. It contains 56,080 mono PCM16 samples at 16 kHz (3.505 seconds). The fixture guide includes attribution, checksums and the aligned clean reference. For your own recording, export mono, 16 kHz, signed 16-bit PCM WAV, at most 60 seconds long. Renaming a file does not convert it.

Add WAV file handling

The example uses dr_wav 0.14.4 for file I/O. Download its pinned single header into the project directory:
Save this helper as audio_file.h alongside dr_wav.h. It checks input format and length, reads float samples and writes a 32-bit float WAV.
audio_file.h

Save the program

Save as quickstart.cpp:
quickstart.cpp

Build and run

Save this complete project as CMakeLists.txt:
CMakeLists.txt
Configure and build from aic-cpp-quickstart:
Run from the project directory so the program can find input.wav and model.aicmodel:

Check the result

A successful run exits with code zero, prints the native SDK version and resolved model ID, then reports Processed N samples at 16000 Hz; wrote enhanced.wav, where N is your input’s sample count (56080 for the supplied fixture). Open enhanced.wav in your audio editor: it should be mono, 16 kHz and the same duration as input.wav. The output is a 32-bit float WAV; the input is PCM16. The program pads the final block, flushes the delayed tail and removes the initial processing delay, preserving the original sample count. File writes are checked; discard any incomplete file if writing fails. Listen to both files and compare them with the same STT settings to evaluate quality.

Recover from an error

The helper check turns a failed ErrorCode into an exception for this application. The SDK wrapper itself returns error codes and Result<T> values: calling .take() without checking .error or .ok() does not throw.

Adapt this example

Keep one processor per stream and process blocks in order. Reset its context on a discontinuity or before unrelated audio. Downmix stereo or use a processor per channel. See audio format and streams and state. The helper reads a short recording into memory. For long files and live audio, use bounded buffers and keep file I/O, model loading and session teardown outside the audio callback. For human-listening enhancement, evaluate Rook Multi Speaker.

Integration behavior

The tutorial converts failed SDK results into exceptions. Use explicit error branches if your application disables exceptions.

Build and deploy

The CMake target aic-sdk carries its native dependency and required system libraries. AIC_SDK_ALLOW_DOWNLOAD=ON enables the configure-time download. To use a preinstalled distribution, supply AIC_SDK_ROOT with include/ and lib/ directories; see the released CMake configuration. Static linking is the default. AIC_SDK_USE_STATIC=OFF selects a shared library and makes its runtime deployment your responsibility. On Windows, match the target architecture and MSVC runtime flavor. Keep model download, object construction and teardown outside the audio callback. The released examples cover enhancement, voice activity detection (VAD) and analysis as separate objects with different model types. See streams and state before combining them.