Skip to main content
ai-coustics Python bindings accept NumPy audio arrays. The tutorial below uses aic-sdk 3.2.0, which wraps native SDK 0.24.0. Use the Python API reference for classes, functions, properties and errors. The released type declarations and examples provide source context.

Installation

Use Python 3.11 for this example on a supported platform. The SDK package declares Python 3.10 or later. This example pins aic-sdk 3.2.0 and NumPy 2.2.6. Create a project directory and a virtual environment:

Quickstart

Prepare the key and input

Generate an SDK key on the developer platform. Set it in the terminal where you will run the example, replacing YOUR_SDK_KEY with your key. Keep it out of source control and shared terminal logs.
Download the noisy speech fixture and save it as input.wav in aic-python-quickstart. 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 a short sentence with background noise as mono, 16 kHz, signed 16-bit PCM WAV. Renaming a file does not convert it. The example downloads quail-vf-2.2-l-16khz into ./models. Quail Voice Focus isolates the primary speaker for speech-to-text (STT) input. The first run needs network access for the model download and SDK key authorization. See authentication for deployment options.

Save and run

Save this complete program as quickstart.py in the same directory:
quickstart.py
Run it from aic-python-quickstart, with the virtual environment active:

Check the result

The program prints the native SDK version, resolved model ID and processed sample count. It writes enhanced.wav beside input.wav at 16 kHz with the same sample count, compensating for processing delay. With the supplied fixture, the processed sample count is 56080. Verify the file headers:
Listen to both recordings and compare them with the same STT settings to evaluate quality.

Recover from an error

Adapt this example

Use one processor per independent stream and retain it between consecutive blocks. Reset its context when seeking or starting unrelated audio. Downmix stereo input or give each channel its own processor. See audio format, streams and state and the Python binding guide for async processing and lifecycle details. This example reads the full file into memory. For live audio or long files, process bounded blocks and keep file I/O, model downloads and session termination outside the audio callback. For human listening, evaluate Rook Multi Speaker.

Integration behavior

Construction, model loading and ProcessorAsync.get_context() are synchronous. Create these objects before the audio loop; using the async processor does not make every operation nonblocking. SDK session termination can block and belongs outside a real-time callback. For voice activity detection (VAD), use a separate Vad or VadAsync with a dedicated VAD model. Pass the original input to VAD alongside enhancement; see ai-coustics VAD and the VAD example. FileAnalyzer provides Python file-analysis helpers for Tyto; this is a different task from enhancement.

Handle SDK errors

Catch specific SDK exception classes where your application can recover. Version 3.2.0 exposes classes such as LicenseFormatInvalidError, ModelVersionUnsupportedError, AudioConfigMismatchError and ProcessingNotAllowedError; their diagnostic text is available as .message. Do not rely on generic ValueError or RuntimeError alone to catch SDK errors. Keep bounded error handling around each stream. A retry does not fix an unsupported model format or an incorrect block size: correct the configuration first. For credential failures, follow authentication. For audio interruptions and processor reuse, follow streams and state.