Home / Companies / AssemblyAI / Blog / Post Details
Content Deep Dive

TTS word timestamps: build read-along highlighting with word boundaries

Blog post from AssemblyAI

Post Details
Company
Date Published
Author
-
Word Count
3,459
Company Posts That Month
10
Language
English
Hacker News Points
-
Post removed?
No
Summary

AssemblyAI’s Text-to-Speech API provides per-token word boundaries that can support synchronized read-along highlighting and live captions, but correct implementation depends on recognizing that timestamps use a continuous session-level audio timeline rather than request-relative time. Each WordBoundaries frame is associated with a request through its flush_id and includes the request’s audio_start_ms, ordered whitespace-split tokens, start and end times, and timing confidence; zero-length entries represent silent tokens and should generally not be highlighted. To avoid drift, especially after multiple requests or interruptions, applications should record the audio player clock when each request’s first buffer is scheduled and calculate playback timing as that request-specific anchor plus start minus audio_start_ms, rather than adding the offset to an already session-relative timestamp. The guide demonstrates enabling boundaries through WebSocket, Python and JavaScript SDKs, and an HTTP streaming endpoint, while showing how browser audio scheduling, token-index mapping, cancellation cleanup, and early-arriving event handling can maintain synchronization. Because timings are delivered on a best-effort basis and may be unavailable for cancelled, empty, unusually long, or failed requests, applications should verify session configuration and allow audio playback to continue without highlights when timing data is absent.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Real-time 1 386 100 56 -91%
Voice AI 1 247 27 10 -91%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.