Implementation:Elevenlabs Elevenlabs python AudioWithTimestampsAndVoiceSegmentsResponseModel
| Field | Value |
|---|---|
| source | Elevenlabs_Elevenlabs_python |
| domains | Audio, Text-to-Speech, Timestamps, Voice Segments |
| last_updated | 2026-02-15 |
Overview
Description
AudioWithTimestampsAndVoiceSegmentsResponseModel is a Pydantic model representing an audio response that includes both character-level timestamp alignments and voice segment information. It carries base64-encoded audio data along with alignment data for both the original and normalized text, and a list of voice segments identifying which voice produced each portion of the audio. This model is auto-generated by Fern from the ElevenLabs API definition and extends UncheckedBaseModel.
Usage
This model is returned by the ElevenLabs text-to-speech API when requesting audio with timestamps and voice segments. It is useful for applications that need precise timing information for lip-syncing, subtitle generation, or voice attribution in multi-speaker scenarios.
Code Reference
Source Location
src/elevenlabs/types/audio_with_timestamps_and_voice_segments_response_model.py
Class Signature
class AudioWithTimestampsAndVoiceSegmentsResponseModel(UncheckedBaseModel):
...
Import Statement
from elevenlabs.types import AudioWithTimestampsAndVoiceSegmentsResponseModel
I/O Contract
| Field | Type | Required | Description |
|---|---|---|---|
| audio_base_64 | str |
Yes | Base64 encoded audio data. Serialized with alias audio_base64.
|
| alignment | Optional[CharacterAlignmentResponseModel] |
No | Timestamp information for each character in the original text. |
| normalized_alignment | Optional[CharacterAlignmentResponseModel] |
No | Timestamp information for each character in the normalized text. |
| voice_segments | List[VoiceSegment] |
Yes | Voice segments for the audio. |
Usage Examples
from elevenlabs.types import AudioWithTimestampsAndVoiceSegmentsResponseModel
import base64
# Typically received as part of an API response
response = AudioWithTimestampsAndVoiceSegmentsResponseModel(
audio_base_64="SGVsbG8gV29ybGQ=",
alignment=CharacterAlignmentResponseModel(...),
normalized_alignment=CharacterAlignmentResponseModel(...),
voice_segments=[VoiceSegment(...)],
)
# Decode the audio data
raw_audio = base64.b64decode(response.audio_base_64)
# Iterate over voice segments
for segment in response.voice_segments:
print(segment)