import { InferenceCallback, RhinoContext, RhinoModel, RhinoOptions } from './types'; export declare class RhinoWorker { private readonly _worker; private readonly _version; private readonly _frameLength; private readonly _sampleRate; private readonly _contextInfo; private static _wasmSimd; private static _wasmSimdLib; private static _wasmPThread; private static _wasmPThreadLib; private static _sdk; private constructor(); /** * Get Rhino engine version. */ get version(): string; /** * Get Rhino frame length. */ get frameLength(): number; /** * Get sample rate. */ get sampleRate(): number; /** * Get Rhino worker instance. */ get worker(): Worker; /** * Get context info. */ get contextInfo(): string; /** * Set base64 wasm file with SIMD feature. * @param wasmSimd Base64'd wasm SIMD file to use to initialize wasm. */ static setWasmSimd(wasmSimd: string): void; /** * Set base64 wasm file with SIMD feature in text format. * @param wasmSimdLib Base64'd wasm SIMD file in text format. */ static setWasmSimdLib(wasmSimdLib: string): void; /** * Set base64 wasm file with SIMD and pthread feature. * @param wasmPThread Base64'd wasm file to use to initialize wasm. */ static setWasmPThread(wasmPThread: string): void; /** * Set base64 SIMD and thread wasm file in text format. * @param wasmPThreadLib Base64'd wasm file in text format. */ static setWasmPThreadLib(wasmPThreadLib: string): void; static setSdk(sdk: string): void; /** * Creates a worker instance of the Rhino Speech-to-Intent engine. * The model size is large, hence it will try to use the existing one if it exists, * otherwise saves the model in storage. * Behind the scenes, it requires the WebAssembly code to load and initialize before * it can create an instance. * * @param accessKey AccessKey generated by Picovoice Console. * @param context RhinoContext object containing a base64 * representation of or path to public binary of a Rhino context model . * @param inferenceCallback User-defined callback invoked upon processing a frame of audio. * The only input argument is an object of type RhinoInference. * @param model RhinoModel object containing a base64 string * representation of or path to public binary of a Rhino parameter model used to initialize Rhino. * @param options Optional configuration arguments. * @param options.device String representation of the device (e.g., CPU or GPU) to use. If set to `best`, the most * suitable device is selected automatically. If set to `gpu`, the engine uses the first available GPU device. To * select a specific GPU device, set this argument to `gpu:${GPU_INDEX}`, where `${GPU_INDEX}` is the index of the * target GPU. If set to `cpu`, the engine will run on the CPU with the default number of threads. To specify the * number of threads, set this argument to `cpu:${NUM_THREADS}`, where `${NUM_THREADS}` is the desired number of * threads. * @param options.endpointDurationSec Endpoint duration in seconds. * An endpoint is a chunk of silence at the end of an utterance that marks * the end of spoken command. It should be a positive number within [0.5, 5]. * A lower endpoint duration reduces delay and improves responsiveness. A higher endpoint duration * assures Rhino doesn't return inference preemptively in case the user pauses before finishing the request. * @param options.requireEndpoint If set to `true`, Rhino requires an endpoint (a chunk of silence) * after the spoken command. If set to `false`, Rhino tries to detect silence, but if it cannot, * it still will provide inference regardless. Set to `false` only if operating in an * environment with overlapping speech (e.g. people talking in the background). * @param options.processErrorCallback User-defined callback invoked if any error happens * while processing the audio stream. Its only input argument is the error message. * * @returns An instance of RhinoWorker. */ static create(accessKey: string, context: RhinoContext, inferenceCallback: InferenceCallback, model: RhinoModel, options?: RhinoOptions): Promise; /** * Processes a frame of audio in a worker. * The transcript result will be supplied with the callback provided when initializing the worker. * Can also send a message directly using 'this.worker.postMessage({command: "process", pcm: [...]})'. * * @param pcm A frame of audio sample. */ process(pcm: Int16Array): void; /** * Resets the internal Rhino state. */ reset(): void; /** * Releases resources acquired by WebAssembly module. */ release(): Promise; /** * Terminates the active worker. Stops all requests being handled by worker. */ terminate(): void; } //# sourceMappingURL=rhino_worker.d.ts.map