Enable live real-time TTS voice synchronization between VoiceManager and KokoroTTS

This commit is contained in:
Adolfo Reyna
2026-08-07 20:23:21 -04:00
parent 469d372338
commit 757261ebfd
3 changed files with 20 additions and 1 deletions
+6
View File
@@ -34,7 +34,13 @@ _EXTRA_SPACE = re.compile(r"[ \t]{2,}")
class SpokenTextFilter(MarkdownTextFilter):
"""Markdown filtering, plus the leftovers that matter when read aloud."""
def __init__(self, voice_manager=None, **kwargs):
super().__init__(**kwargs)
self._voice_manager = voice_manager
async def filter(self, text: str) -> str:
if self._voice_manager:
self._voice_manager.sync_voice()
text = _TIMES.sub(" times ", text)
text = await super().filter(text)
text = _STRIKETHROUGH.sub(r"\1", text)