/** * Simple EventEmitter implementation for browser compatibility */ export declare class EventEmitter { private events; on(event: string, listener: Function): this; once(event: string, listener: Function): this; off(event: string, listener: Function): this; emit(event: string, ...args: any[]): boolean; removeAllListeners(event?: string): this; } /** * Configuration options for speech recognition engines */ export interface SpeechRecognitionConfig { /** Language code (e.g., 'en-US', 'es-ES') */ language?: string; /** Sample rate for audio processing */ sampleRate?: number; /** Enable continuous recognition */ continuous?: boolean; /** Return interim results */ interimResults?: boolean; /** Maximum number of alternatives to return */ maxAlternatives?: number; /** Confidence threshold (0-1) */ confidenceThreshold?: number; /** Custom vocabulary or phrases to improve recognition */ phrases?: string[]; /** Audio encoding format */ encoding?: 'LINEAR16' | 'FLAC' | 'MULAW' | 'AMR' | 'AMR_WB' | 'OGG_OPUS' | 'SPEEX_WITH_HEADER_BYTE'; } /** * Speech recognition result */ export interface SpeechRecognitionResult { /** Transcribed text */ transcript: string; /** Confidence score (0-1) */ confidence: number; /** Whether this is a final result */ isFinal: boolean; /** Alternative transcriptions */ alternatives?: Array<{ transcript: string; confidence: number; }>; /** Timestamp information */ timestamp?: { start: number; end: number; }; } /** * Audio input source configuration */ export interface AudioInputConfig { /** Audio source type */ source: 'microphone' | 'file' | 'stream'; /** File path (for file source) */ filePath?: string; /** Audio stream (for stream source) */ audioStream?: NodeJS.ReadableStream; /** Device ID (for microphone source) */ deviceId?: string; /** Recording duration in milliseconds (for microphone) */ duration?: number; } /** * Engine-specific configuration */ export interface EngineConfig { /** Engine type */ engine: 'web-speech' | 'vosk' | 'google-cloud' | 'whisper'; /** API key (for cloud services) */ apiKey?: string; /** Model path (for offline engines like Vosk) */ modelPath?: string; /** Project ID (for Google Cloud) */ projectId?: string; /** Custom endpoint URL */ endpoint?: string; } /** * Error types that can occur during speech recognition */ export declare enum SpeechRecognitionErrorType { NO_SPEECH = "no-speech", ABORTED = "aborted", AUDIO_CAPTURE = "audio-capture", NETWORK = "network", NOT_ALLOWED = "not-allowed", SERVICE_NOT_ALLOWED = "service-not-allowed", BAD_GRAMMAR = "bad-grammar", LANGUAGE_NOT_SUPPORTED = "language-not-supported", ENGINE_ERROR = "engine-error", INVALID_CONFIG = "invalid-config" } /** * Speech recognition error */ export declare class SpeechRecognitionError extends Error { type: SpeechRecognitionErrorType; originalError?: Error | undefined; constructor(type: SpeechRecognitionErrorType, message: string, originalError?: Error | undefined); } /** * Events emitted by speech recognition engines */ export interface SpeechRecognitionEvents { 'start': () => void; 'result': (result: SpeechRecognitionResult) => void; 'end': () => void; 'error': (error: SpeechRecognitionError) => void; 'audiostart': () => void; 'audioend': () => void; 'soundstart': () => void; 'soundend': () => void; 'speechstart': () => void; 'speechend': () => void; 'initialized': () => void; 'started': () => void; 'stopped': () => void; } /** * Base interface for speech recognition engines */ export interface ISpeechRecognitionEngine extends EventEmitter { /** Start speech recognition */ start(audioConfig: AudioInputConfig, recognitionConfig?: SpeechRecognitionConfig): Promise; /** Stop speech recognition */ stop(): Promise; /** Abort speech recognition */ abort(): Promise; /** Check if engine is available */ isAvailable(): boolean; /** Get supported languages */ getSupportedLanguages(): string[]; /** Process audio file directly */ processFile(file: File, config?: SpeechRecognitionConfig): Promise; /** Process audio stream */ processStream(stream: NodeJS.ReadableStream, config?: SpeechRecognitionConfig): Promise; } /** * Voice-to-text converter options */ export interface VoiceToTextOptions { /** Default engine configuration */ defaultEngine?: EngineConfig; /** Default speech recognition configuration */ defaultRecognitionConfig?: SpeechRecognitionConfig; /** Enable automatic engine fallback */ enableFallback?: boolean; /** Engine priority order for fallback */ enginePriority?: Array; /** Debug mode */ debug?: boolean; } /** * Microphone recording options */ export interface MicrophoneOptions { /** Recording duration in milliseconds */ duration?: number; /** Device ID to use */ deviceId?: string; /** Sample rate */ sampleRate?: number; /** Number of channels */ channels?: number; /** Bit depth */ bitDepth?: number; /** Audio format */ format?: 'wav' | 'raw'; } /** * Browser compatibility information */ export interface BrowserSupport { /** Whether Web Speech API is supported */ webSpeechAPI: boolean; /** Whether MediaRecorder API is supported */ mediaRecorder: boolean; /** Whether getUserMedia is supported */ getUserMedia: boolean; /** Browser name and version */ browser: { name: string; version: string; }; } /** * Props for VoiceRecorder component */ export interface VoiceRecorderProps { /** CSS class name */ className?: string; /** Whether to show language selector */ showLanguageSelector?: boolean; /** Whether to show results display */ showResults?: boolean; /** Whether to show recording controls */ showControls?: boolean; /** Default language */ language?: string; /** Enable continuous recording */ continuous?: boolean; /** Show interim results */ interimResults?: boolean; /** Callback when result is received */ onResult?: (result: SpeechRecognitionResult) => void; /** Callback when error occurs */ onError?: (error: string) => void; /** Callback when recording starts */ onStart?: () => void; /** Callback when recording stops */ onStop?: () => void; /** Child components */ children?: React.ReactNode; } /** * Props for FileUpload component */ export interface FileUploadProps { /** CSS class name */ className?: string; /** Callback when file is selected */ onFileSelect?: (file: File) => void; /** Callback when file is converted */ onConvert?: (file: File, language: string) => Promise; /** Callback when error occurs */ onError?: (error: string) => void; /** Accepted file formats */ acceptedFormats?: string[]; /** Maximum file size in bytes */ maxFileSize?: number; /** Whether to show language selector */ showLanguageSelector?: boolean; /** Default language */ language?: string; /** Enable drag and drop */ dragAndDrop?: boolean; /** Allow multiple file selection */ multiple?: boolean; /** Whether component is disabled */ disabled?: boolean; /** Child components */ children?: React.ReactNode; } /** * Props for ResultsDisplay component */ export interface ResultsDisplayProps { /** Array of recognition results */ results: SpeechRecognitionResult[]; /** Error message */ error?: string | null; /** Callback to clear results */ onClear?: () => void; /** Whether to show clear button */ showClearButton?: boolean; /** Whether to show confidence scores */ showConfidence?: boolean; /** Whether to show status (final/interim) */ showStatus?: boolean; /** Maximum number of results to display */ maxResults?: number; /** CSS class name */ className?: string; /** Text to show when no results */ emptyText?: string; } /** * Props for LanguageSelector component */ export interface LanguageSelectorProps { /** Selected language value */ value?: string; /** Callback when language changes */ onChange?: (language: string) => void; /** Whether component is disabled */ disabled?: boolean; /** CSS class name */ className?: string; /** Whether to show label */ showLabel?: boolean; /** Label text */ label?: string; /** Placeholder text */ placeholder?: string; } /** * Props for RecordingControls component */ export interface RecordingControlsProps { /** Whether currently recording */ isRecording: boolean; /** Whether currently processing */ isProcessing: boolean; /** Callback to start recording */ onStart?: () => void; /** Callback to stop recording */ onStop?: () => void; /** Whether component is disabled */ disabled?: boolean; /** CSS class name */ className?: string; /** Whether to show status */ showStatus?: boolean; /** Text for start button */ startText?: string; /** Text for stop button */ stopText?: string; /** Text for processing state */ processingText?: string; } //# sourceMappingURL=index.d.ts.map