Forced alignment takes an audio file and its exact transcript text, then returns precise timestamps at both the word and character level. Unlike automatic speech recognition — which transcribes unknown audio — forced alignment assumes you already know exactly what was spoken and instead tells you when each word and character occurs in the recording. This makes it ideal for subtitle generation, karaoke timing, and audio editing workflows where frame-accurate markers are required.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/elevenlabs/llms.txt
Use this file to discover all available pages before exploring further.
Usage
Callcreate() with a Content::audio() value and the verbatim transcript string. It returns a ForcedAlignmentResult immediately.
Parameters
The audio recording to align. Use
Content::audio() with a local file path or binary data. The file is uploaded as a multipart form file part with the fixed filename audio.wav and content type audio/wav, regardless of the original filename.The exact transcript of what is spoken in the audio. Must match the spoken content word-for-word.
Return Type
ForcedAlignmentResult
Character-level alignment. Each
AlignmentItem represents a single character with its start and end time in the audio.Word-level alignment. Each
AlignmentItem represents a whole word token with its start and end time.An alignment quality score for the entire result. Lower values indicate a closer match between the audio and the provided transcript. A high loss score suggests the transcript may not match the audio.
The full decoded JSON response from the ElevenLabs API for inspection or debugging.
AlignmentItem
Each entry in both characters and words is an AlignmentItem.
The character or word token this item represents.
Start time of this token in seconds, measured from the beginning of the audio file.
End time of this token in seconds.
Per-token alignment quality score. Present on word-level items; may be
null on character-level items.Working with the Results
Word-level timing
Word-level timestamps are useful for subtitle generation and karaoke-style highlighting, where you need to know when each word begins and ends.Character-level timing
Character-level timestamps let you animate text at the individual letter level — useful for karaoke underlining or precise audio-editing markers.Inspecting alignment quality
Theloss property is available at both the result level and on individual word tokens. Use it to detect misaligned segments or to validate that the supplied transcript matches the audio before producing final output.
Typical Use Cases
Subtitle Generation
Convert word-level timestamps directly into SRT or VTT cue times, mapping each word to the exact moment it is spoken.
Karaoke Timing
Drive character- or word-level highlighting in real time by triggering UI updates at the precise
start time of each token.Audio Editing Markers
Import word timestamps as named markers in a DAW or video editor to jump immediately to any word in a long recording.
