acceptable-dream-85180
08/07/2025, 3:06 PMuse_tts_aligned_transcript=True
and tts=cartesia.TTS(model="sonic-2", voice="f786b574-daa5-4673-aa0c-cbe3e8534c02", language="en")
but the transcript does not show word level timestamp transcriptiontall-airline-16756
08/07/2025, 3:06 PMtall-airline-16756
08/07/2025, 3:06 PMuse_tts_aligned_transcript=True
in your configuration. This synchronizes transcription output with speech timing for supported TTS providers.
2. Use a Supported TTS Provider: Currently, only Cartesia and ElevenLabs support word-level transcription timing. For other providers, alignment is applied at the sentence level.
3. Access Timing Information: Implement a transcription_node
method in your agent to access timing information. The iterator yields TimedString
objects, which include start_time
and end_time
for each word.
Here is an example implementation for accessing timing information:
async def transcription_node(
self, text: AsyncIterable[str | TimedString], model_settings: ModelSettings
) -> AsyncGenerator[str | TimedString, None]:
async for chunk in text:
if isinstance(chunk, TimedString):
<http://logger.info|logger.info>(f"TimedString: '{chunk}' ({chunk.start_time} - {chunk.end_time})")
yield chunk
Ensure that your TTS provider explicitly supports this feature. For unsupported providers, alignment will only be at the sentence level.
Let me know if you need further assistance!
Sources: Text and transcriptions | LiveKit Docs | ElevenLabs TTS integration guide | LiveKit Docs | Cartesia TTS integration guide | LiveKit Docs | livekit-agents/livekit/agents/tts/tts.pyacceptable-dream-85180
08/07/2025, 3:09 PMtall-airline-16756
08/07/2025, 3:09 PMTimedString
class comes from the <http://livekit.agents.voice.io|livekit.agents.voice.io>
module. You can grab it with this import statement:
from <http://livekit.agents.voice.io|livekit.agents.voice.io> import TimedString
If you have any questions or need a hand with anything else, just let me know—I’m here to help!acceptable-dream-85180
08/07/2025, 3:16 PMtall-airline-16756
08/07/2025, 3:17 PM