Enable live real-time TTS voice synchronization between VoiceManager and KokoroTTS
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user