Final fix for AsyncAI TTS transcription duplication
The debug logging confirmed the issue was resolved with the proper flag tracking and reset_word_timestamps() call. AsyncAI TTS now generates transcription frames once per text input, matching Cartesia TTS behavior. Working solution: - Track transcription generation with _transcription_generated flag - Reset flag and word timestamps for each new text input - Only generate transcription on first audio chunk per text - Proper cleanup ensures no duplicate transcriptions
This commit is contained in:
@@ -302,10 +302,6 @@ class AsyncAITTSService(WebsocketWordTTSService):
|
||||
await self.add_word_timestamps([("TTSStoppedFrame", 0), ("Reset", 0)])
|
||||
self._transcription_generated = True
|
||||
logger.debug(f"{self}: Transcription flag set to True")
|
||||
else:
|
||||
logger.debug(
|
||||
f"{self}: Skipping transcription generation - already generated: {self._transcription_generated}, text: '{self._current_text}'"
|
||||
)
|
||||
|
||||
frame = TTSAudioRawFrame(
|
||||
audio=base64.b64decode(msg["audio"]),
|
||||
@@ -346,7 +342,7 @@ class AsyncAITTSService(WebsocketWordTTSService):
|
||||
Yields:
|
||||
Frame: Audio frames containing the synthesized speech.
|
||||
"""
|
||||
logger.debug(f"{self}: Generating TTS [{text}]")
|
||||
logger.debug(f"{self}: AsyncAI Generating TTS [{text}]")
|
||||
|
||||
try:
|
||||
if not self._websocket or self._websocket.state is State.CLOSED:
|
||||
|
||||
Reference in New Issue
Block a user