Audio requirements
The SDK handles one mono audio stream per object. Each call accepts a contiguous block of decodedfloat32 PCM samples.
Provide:
- One channel (mono)
- Decoded PCM samples in
float32format, normally scaled to[-1.0, 1.0], with no NaN or infinite values - The same sample rate used to initialize the object
- The configured block size, or a smaller block if variable block sizes are enabled
Audio entry points
Three objects take audio, with the same mono requirements but different roles:
Make sure the VAD and collector receive the original input rather than the processor’s enhanced output. See Using VAD alongside enhancement and Real-time analysis.
Block size
Set the block size at initialization. It is the maximum number of mono samples per call.- For fixed-block mode (
variable_block_size = false), every call must contain exactly the initializedblock_size. - For variable-block mode (
variable_block_size = true), every call may contain up to the initializedblock_size. Larger calls are always rejected. - Use a positive block size at a supported sample rate (8,000–192,000 Hz for core SDK 0.24.0). The model’s optimal block size is the one that avoids extra buffering, and therefore gives the lowest delay.
block_size and variable_block_size configuration. Initialize objects sharing an input block for the same audio format, even if their model optima differ.
Changing the sample rate or maximum block size requires reinitializing the object. Initialization allocates memory, so do not perform it on a real-time audio thread. To clear an object’s history without changing its format, reset it instead. See Streams and state.
Partial and empty input
A final file chunk may be shorter thanblock_size. In fixed-block mode, pad it with zeros and track the original sample count, as the Python quickstart does. Variable-block mode accepts shorter calls but adds buffering. Avoid submitting empty frames in a live pipeline; they carry no new audio and are not an end-of-stream signal.
For file enhancement, flush the delayed tail by processing sufficient silence, remove the leading SDK delay and trim the saved output to the original sample count. Query the initialized processor’s delay instead of assuming a constant. Do not apply enhancement-tail handling to VAD as though it produced delayed audio.
Host and model sample rates
Configure the SDK with the sample rate of the samples you actually provide. The native model rate is not permission to relabel samples recorded at another rate. The core pipeline handles supported non-native host rates; conversion adds work and does not recover frequencies missing from the recording. See non-native sample rates.FileAnalyzer accepts a complete decoded mono array and configures its collector internally. File decoding and channel selection remain your application’s responsibility.
Multi-channel input
How you prepare multi-channel input depends on what its channels represent.One recording with multiple channels
Mix the channels down to one mono stream in your application, then pass the mono samples to the SDK. Your application is also responsible for choosing the output channel layout, if a downstream system requires multi-channel audio. For a simple average mixdown withN channels:
A simple average can reduce the level of signals that are out of phase. Use an appropriate downmix matrix or audio library when channel layout, gain or phase relationships matter.
Independent streams stored as channels
If each channel contains a distinct stream, e.g. two sides of a call, do not mix them together. Create and initialize one processor per channel, and pass each channel to its processor as a mono buffer.Codecs
Decode MP3, AAC, Opus, G.711 or other encoded input to monofloat32 PCM in your application or media stack. The SDK does not decode files or network packets. Encode the enhanced output as needed for your application.
Common pitfalls
- Passing interleaved, sequential or planar multi-channel data directly to a process call
- Treating the total number of samples in a multi-channel buffer as the mono block size
- Processing distinct channel streams with one processor
- Using a sample count that does not match the initialized block size (
AIC_ERROR_CODE_AUDIO_CONFIG_MISMATCH) - Reinitializing a processor on a real-time audio thread
- Feeding the VAD or the collector the processor’s enhanced output instead of the original input
- Initializing objects that share an input block for different sample rates or block sizes