@ai-coustics/aic-sdk 0.24.0, Core SDK 0.24.0. API index · Node.js quickstart.
Analyzer
A mono audio collector and analysis engine combined in one JavaScript object. Use an analysis model such as Tyto. Initialize, buffer original audio and analyze the retained window. Only the model’s maximum window is retained; new audio replaces older audio. Short histories are zero-padded.
Analyzer.constructor
model must be a live analysis model, not an enhancement or VAD model. licenseKey is an SDK credential. Construction synchronously creates the collector/analyzer pair and can throw for credentials, model type or disposal errors. There is no per-instance OtelConfig constructor argument. Call initialize before buffer.
Analyzer.dispose
Analyzer has been disposed. Await outstanding analysis first.
Analyzer.initialize
sampleRate is a whole-number rate in Hz; blockSize is a positive whole-number mono sample count. Query model.getOptimalBlockSize(sampleRate) for the preferred size. Omitted, undefined or null variableBlockSize means false, requiring exactly blockSize samples. Variable mode allows shorter blocks, with possible buffering delay, but rejects larger blocks. Unsupported configurations throw an SDK error. Initialization allocates memory. Configures the collector synchronously. For Tyto, use its native 16 kHz input and the block size returned by the model query. A failed reinitialization leaves the collector uninitialized; correct the configuration before buffering again.
Analyzer.buffer
Float32Array without modifying it and collects samples for later analysis. Returns void; it does not run the analysis model. Requires successful initialization and the configured block length. It can continue while analyzeAsync runs because collection does not take the analyzer lock. Older audio is discarded as the model window fills.
Analyzer.analyze
AnalysisResult. Blocks the calling thread and can wait for an earlier async analysis. Short or empty histories are zero-padded; the SDK does not provide a readiness check here. Track the amount of real buffered audio yourself. Throws for disallowed processing or native analysis failure.
Analyzer.analyzeAsync
AnalysisResult. The worker reads the available buffered snapshot when it executes; submission does not freeze the collector. Collection can continue in parallel. Await before assuming completion or disposing. Native analysis failures reject the promise. This is expensive analysis, not an audio-callback operation.
Analyzer.reset
buffer applies that reset, analysis uses a zero-filled snapshot instead of stale audio. Waits for the analyzer lock and can block during async analysis.
Analyzer.updateBearerToken
token replaces a bearer token on a JWT-authenticated session. Both the original credential and replacement must be JWT-form licenses. A synchronous failure preserves the previous token. Return without error confirms local format acceptance, not backend acceptance; subsequent reporting can reject the token and eventually disable work. Obtain a valid replacement to recover. This operation allocates and takes a lock; keep it outside audio callbacks. See authentication. This synchronous method also waits for any active analysis holding the analyzer lock.
Analyzer.terminateSession
dispose(). Completion may involve asynchronous session handling when another session remains active. Do not use it as a flush operation. Synchronous; can block on the analyzer lock and session handling.
AnalysisResult
A returned object with seven number fields, not a class to construct. Values are normalized scores from 0 to 1. Lower values indicate less problematic audio except for speakerLoudness, where loudness itself is measured. These are model estimates, not a guarantee of transcription quality. See Tyto for interpretation.
AnalysisResult.riskScore
AnalysisResult.speakerReverb
AnalysisResult.speakerLoudness
AnalysisResult.interferingSpeech
AnalysisResult.noise
AnalysisResult.codecDegradation
AnalysisResult.packetLoss
Example
With the pinned package installed, setAIC_SDK_LICENSE and run node analyze-window.cjs path/to/tyto.aicmodel. It collects at least 5 s of silence and prints seven score fields. For call-quality evaluation, use representative audio and follow real-time analysis for window interpretation.
analyze-window.cjs