web-voice-detection
Version:
A WebAssembly-powered Voice Activity Detection library for the browser.
21 lines (20 loc) • 1.09 kB
TypeScript
import { FrameProcessorInterface, FrameProcessorOptions } from "./frame-processor";
import { ModelFetcher, ONNXRuntimeAPI, OrtOptions } from "./models";
type NonRealTimeDetectionSpeechData = {
audio: Float32Array;
start: number;
end: number;
};
export type NonRealTimeDetectionOptions = FrameProcessorOptions & OrtOptions;
export declare const defaultNonRealTimeDetectionOptions: NonRealTimeDetectionOptions;
export declare class PlatformAgnosticNonRealTimeDetection {
modelFetcher: ModelFetcher;
ort: ONNXRuntimeAPI;
options: NonRealTimeDetectionOptions;
frameProcessor: FrameProcessorInterface | undefined;
static _new(modelFetcher: ModelFetcher, ort: ONNXRuntimeAPI, options: NonRealTimeDetectionOptions): Promise<PlatformAgnosticNonRealTimeDetection>;
constructor(modelFetcher: ModelFetcher, ort: ONNXRuntimeAPI, options: NonRealTimeDetectionOptions);
init: () => Promise<void>;
run: (this: PlatformAgnosticNonRealTimeDetection, inputAudio: Float32Array, sampleRate: number) => AsyncGenerator<NonRealTimeDetectionSpeechData>;
}
export {};