voice-to-text-converter
Version:
A modern, lightweight Node.js package for speech-to-text conversion with support for multiple engines
69 lines • 2.01 kB
TypeScript
import { BaseSpeechRecognitionEngine } from './base-engine';
import { SpeechRecognitionConfig, SpeechRecognitionResult, AudioInputConfig } from '../types';
declare global {
interface Window {
SpeechRecognition: any;
webkitSpeechRecognition: any;
}
}
/**
* Web Speech API engine for browser environments
*/
export declare class WebSpeechEngine extends BaseSpeechRecognitionEngine {
private recognition;
private mediaRecorder;
private audioChunks;
constructor();
/**
* Check if Web Speech API is available
*/
isAvailable(): boolean;
/**
* Get supported languages (common languages supported by most browsers)
*/
getSupportedLanguages(): string[];
/**
* Start speech recognition
*/
start(audioConfig: AudioInputConfig, recognitionConfig?: SpeechRecognitionConfig): Promise<void>;
/**
* Initialize speech recognition instance
*/
private initializeRecognition;
/**
* Start microphone recognition
*/
private startMicrophoneRecognition;
/**
* Process audio file (requires MediaRecorder API)
*/
private processAudioFile;
/**
* Stop speech recognition
*/
stop(): Promise<void>;
/**
* Abort speech recognition
*/
abort(): Promise<void>;
/**
* Process audio file directly (not supported by Web Speech API)
*/
processFile(filePath: string, config?: SpeechRecognitionConfig): Promise<SpeechRecognitionResult[]>;
/**
* Process audio stream (not supported by Web Speech API)
*/
processStream(stream: NodeJS.ReadableStream, config?: SpeechRecognitionConfig): Promise<SpeechRecognitionResult[]>;
/**
* Get available audio input devices
*/
static getAudioDevices(): Promise<MediaDeviceInfo[]>;
/**
* Check browser compatibility
*/
static getBrowserSupport(): {
supported: boolean;
features: string[];
};
}
//# sourceMappingURL=web-speech-engine.d.ts.map