Engine Architecture
Voice Engine Architecture
tts/engine.py, BaseVoiceEngine, SSML handling, and alignment generation.
All speech synthesizers in Video-Labs subclass BaseVoiceEngine in tts/engine.py.
1. The BaseVoiceEngine Interface
class BaseVoiceEngine(ABC):
@abstractmethod
def synthesize(self, text: str, voice: str, speed: float = 1.0) -> AudioResult:
"""
Synthesizes audio and extracts word-level timing boundaries.
Returns:
audio_bytes: 24 kHz mono uncompressed PCM audio.
timeline: List of { word, start, end } timestamp objects.
"""
pass2. Supported Engine Adapters
EdgeTTSEngine: Converts text to SSML with<prosody rate="..." pitch="...">. Reads Microsoft streaming subtitle events to extract exact word timings.KokoroEngine: Runs local PyTorch weights on Apple Silicon MPS device. Extracts phoneme durations directly from model hidden states.MeloTTSEngine: Multi-accented local neural engine for British, American, and Indian English accents.Qwen3TTSEngine: Alibaba Qwen3-TTS engine with pre-flight model caching checks.ElevenLabsEngine: Cloud API client for studio-grade voice cloning.