sandai-react
Version:
React components and utilities for the Sandai 3D AI Characters.
32 lines • 1.19 kB
TypeScript
export type AsrEvent = "loading" | "ready" | "start" | "update" | "complete" | "progress" | "error";
export type AsrListener = (data?: any) => void;
export type AudioInput = Float32Array | {
array: Float32Array;
sampling_rate: number;
};
export declare class AsrClient {
private _worker;
private listeners;
static readonly modelPaths: {
whisper: {
model: string;
dtype: {
encoder_model: string;
decoder_model_merged: string;
};
};
};
private _pendingInit?;
private _pendingGen?;
constructor(workerPath: string | URL);
on(event: AsrEvent, handler: AsrListener): () => void;
private emit;
private _handleWorkerMessage;
/** Load model & warm up. Resolves when we receive `ready`. */
initialize(config?: typeof AsrClient.modelPaths.whisper): Promise<void>;
/** One-shot recognition. Streams `update` tokens and resolves on `complete`. */
generate(audio: AudioInput, language?: string, config?: typeof AsrClient.modelPaths.whisper): Promise<string | string[]>;
/** Cleanup */
terminate(): void;
}
//# sourceMappingURL=asr-client.d.ts.map