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.22.0 GIT_SHALLOW TRUE)FetchContent_MakeAvailable(aic_sdk)target_link_libraries(my_app PRIVATE aic-sdk)
#include "aic.hpp"#include <cstdlib>#include <vector>int main() { // Get your license key from the environment variable const char* license_key = std::getenv("AIC_SDK_LICENSE"); // Load a model (download models at https://artifacts.ai-coustics.io/) auto model = aic::Model::create_from_file("path/to/model.aicmodel").take(); // Create processor with license key auto processor = aic::Processor::create(model, license_key).take(); // Get optimal configuration auto sample_rate = model.get_optimal_sample_rate(); auto block_size = model.get_optimal_block_size(sample_rate); // Initialize processor with optimal settings processor.initialize(sample_rate, block_size, false); // Process audio (Mono only) std::vector<float> audio(block_size, 0.0f); processor.process(audio.data(), audio.size()); // Cleanup happens in the destructors return 0;}
Was this page helpful?
⌘I
Assistant
Responses are generated using AI and may contain mistakes.