expo-edge-speech
Version:
Text-to-speech library for Expo using Microsoft Edge TTS service
85 lines • 2.53 kB
TypeScript
import type { SpeechOptions, EdgeSpeechVoice } from "../types";
import { StateManager, SynthesisSession } from "./state";
import { ConnectionManager } from "./connectionManager";
import { AudioService } from "../services/audioService";
import { VoiceService } from "../services/voiceService";
import { NetworkService } from "../services/networkService";
/**
* Main synthesizer that coordinates complete speech synthesis workflow.
* Provides expo-speech compatible API while coordinating all internal services.
*/
export declare class Synthesizer {
private stateManager;
private connectionManager;
private audioService;
private voiceService;
private networkService;
private sessions;
private currentSession;
constructor(stateManager: StateManager, connectionManager: ConnectionManager, audioService: AudioService, voiceService: VoiceService, networkService: NetworkService);
/**
* Setup event handlers for service coordination
*/
private setupEventHandlers;
/**
* Main speech synthesis function - expo-speech compatible
*/
speak(text: string, options?: SpeechOptions): Promise<void>;
/**
* Get available voices - expo-speech compatible
*/
getAvailableVoicesAsync(): Promise<EdgeSpeechVoice[]>;
/**
* Check if currently speaking - expo-speech compatible
*/
isSpeakingAsync(): Promise<boolean>;
/**
* Stop current speech synthesis and playback
*/
stop(): Promise<void>;
/**
* Pause current playback
*/
pause(): Promise<void>;
/**
* Resume paused playback
*/
resume(): Promise<void>;
/**
* Create a new synthesis session using universal session ID format
*/
private createSession;
/**
* Process a synthesis session through the complete workflow
*/
private processSession;
/**
* Resolve voice for synthesis
*/
private resolveVoice;
/**
* Process boundary events from synthesis
*/
private processBoundaryEvents;
/**
* Handle session completion
*/
private handleSessionComplete;
/**
* Handle session errors
*/
private handleSessionError;
/**
* Get current synthesis status
*/
getCurrentSession(): SynthesisSession | null;
/**
* Get all active sessions
*/
getAllSessions(): SynthesisSession[];
/**
* Clear all sessions and reset synthesizer
*/
reset(): Promise<void>;
}
//# sourceMappingURL=synthesizer.d.ts.map