Skip to main content

View on GitHub

Full reference, examples, and release notes.

Installation

The easiest way to integrate the SDK into your C++ project is using CMake FetchContent. This will automatically download the source code and libraries, then link them to your project.
include(FetchContent)

set(AIC_SDK_ALLOW_DOWNLOAD ON CACHE BOOL "Allow C SDK download at configure time")

FetchContent_Declare(
    aic_sdk
    GIT_REPOSITORY https://github.com/ai-coustics/aic-sdk-cpp.git
    GIT_TAG        0.17.0
)
FetchContent_MakeAvailable(aic_sdk)

target_link_libraries(my_app PRIVATE aic-sdk)

Quickstart

#include "aic.hpp"

#include <vector>
#include <cstdlib>

int main() {
    // Get your license key from the environment variable
    const char* license_key = std::getenv("AIC_SDK_LICENSE");

    // Load a model from file (download models at https://artifacts.ai-coustics.io/)
    auto model = aic::Model::create_from_file("./models/model.aicmodel").take();

    // Create configuration with model's optimal settings
    auto sample_rate = model.get_optimal_sample_rate();
    auto num_frames = model.get_optimal_num_frames(sample_rate);
    aic::ProcessorConfig config(sample_rate, num_frames, 2);  // 2 channels (stereo)

    // Create and initialize processor
    auto processor = aic::Processor::create(model, license_key).take();
    processor.initialize(config.sample_rate, config.num_channels, config.num_frames,
                         config.allow_variable_frames);

    // Process audio (planar layout: separate buffer per channel)
    std::vector<float> left(config.num_frames, 0.0f);
    std::vector<float> right(config.num_frames, 0.0f);
    std::vector<float*> audio = {left.data(), right.data()};
    processor.process_planar(audio.data(), config.num_channels, config.num_frames);

    return 0;
}