interface ISlangAsrHandshakeRequest { sampleRateHertz: number; languageCodes: string[]; audioEncoding: string; responseEncoding: number; apiKey: string; appID: string; phrases: string[]; metadata: { industryNaicsCodeOfAudio: number; recordingDeviceType: number; model: string; interactionType: Number; microphoneDistance: number; useEnhanced: boolean; speechAdaptaion: any; }; } interface IAudioWorkletBuffer { inputBuffer: { getChannelData: () => Float32Array; }; } declare global { interface Window { AudioContext: typeof AudioContext; webkitAudioContext: typeof AudioContext; } } declare class AsrSubsystem { static identifier: string; stream: MediaStream; processor: ScriptProcessorNode | AudioWorkletNode | null; socket: WebSocket | undefined; ackRecieved: boolean; buf: any[]; lastFinal: string; asrTimeoutTimer: ReturnType | null; slowASRHandshakeInterval: ReturnType | null; textAccumulator: string[]; alternativeTextAccumulator: string[][]; currentTextPartials: string[]; alternativeTextPartials: string[][]; currentlyListening: boolean; audioContext: AudioContext | null; analyzerNode: AnalyserNode | null; getStream: () => Promise; _loadWorklet: () => Promise; startListening: () => Promise; /** * cleans up all resources */ cleanUpResources: () => Promise; /** * clean up resources and set currentlyListening to false */ stopListening: () => void; /** * called every time there is an audio event. responsible for actually streaming the data * @processor_node(ScriptProcessorNode) sends AudioProcessingEvent * @processor_node(AudioWorkletNode) sends custom interface IAudioWorkletBuffer */ streamAudioData: (e: AudioProcessingEvent | IAudioWorkletBuffer) => void; clearASRTimeout: () => void; clearASRHandshakeInterval: () => void; performASRFixups(textFinal: string): string; setupSocket: (handshakeMessage: ISlangAsrHandshakeRequest) => void; } declare const asr: AsrSubsystem; export { asr };