assemblyai
Version:
The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, as well as the latest LeMUR models.
23 lines (22 loc) • 996 B
TypeScript
/**
* Linear-interpolation resampler for streaming Float32 audio. Stateful across
* `process()` calls so chunk boundaries don't introduce phase discontinuities:
* the last input sample and a fractional read position are carried over.
*
* Linear interpolation is good enough for ASR ingest — the downstream
* StreamingTranscriber band-limits at the target rate anyway, and a polyphase
* filter would be overkill in the AudioWorklet hot path. If a customer needs
* higher quality they can supply their own VadDetector + bypass the encoder.
*/
export declare class LinearResampler {
private readonly sourceRate;
private readonly targetRate;
private readonly ratio;
private lastSample;
private fractional;
constructor(sourceRate: number, targetRate: number);
process(input: Float32Array): Float32Array;
reset(): void;
}
/** Convert Float32 PCM (-1..1) to little-endian Int16 PCM. */
export declare function float32ToPcm16(input: Float32Array): ArrayBuffer;