Skip to content

API Reference parrot.voice.tts.models

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.voice.tts.models

View source

TTS Data Models.

Pydantic models for text-to-speech configuration and synthesis results. These models are shared across all TTS backends (Google, ElevenLabs, etc.) and the VoiceSynthesizer service.

Added by FEAT-213 (Telegram Voice Reply TTS Output). Mirrors the structure of parrot.voice.transcriber.models for symmetry.

Class SynthesisResult

Result of a text-to-speech synthesis call.

Contains the raw audio bytes and metadata about the synthesized audio.

Example::

result = SynthesisResult(audio=b"...", mime_format="audio/ogg")
assert result.duration_s is None  # not populated unless backend provides it

Fields:

Field Type Default Description
audio bytes Raw audio bytes as produced by the backend. The actual container format matches mime_format (e.g. WAV PCM bytes for "audio/wav").
mime_format str MIME type of the audio data (e.g. "audio/wav", "audio/ogg").
duration_s Optional[float] None Duration of the synthesized audio in seconds. None when not available from the backend.

Class TTSConfig

Configuration for text-to-speech synthesis.

Controls which backend to use and the audio output format. All fields are optional; defaults produce a Google TTS backend with OGG/Opus output (the preferred format for Telegram voice notes).

Example::

cfg = TTSConfig(backend="google", voice="Charon", language="en-US")
cfg = TTSConfig(backend="supertonic", voice="F1", total_step=8, speed=1.05)

Fields:

Field Type Default Description
backend Literal['google', 'elevenlabs', 'openai', 'supertonic', 'polly'] 'google' TTS backend to use. Currently only "google" is implemented; "elevenlabs" and "openai" are reserved for future use and will raise ValueError at runtime.
voice Optional[str] None Backend-specific voice identifier (e.g. "Charon", "Kore" for the Google backend). None falls back to the backend's default voice.
language Optional[str] None BCP-47 language tag (e.g. "en-US"). None delegates language selection to the backend.
mime_format str 'audio/ogg' MIME type of the desired audio output. Telegram voice notes prefer "audio/ogg" (OGG/Opus).
total_step int 8 Supertonic only — number of flow-matching denoising steps. Higher is smoother but slower; ignored by other backends.
speed float 1.05 Supertonic only — speech-rate multiplier (>1 = faster); ignored by other backends.
polly_engine Literal['long-form', 'generative', 'neural', 'standard'] 'long-form' Amazon Polly engine. Ignored by non-Polly backends.
polly_region Optional[str] None Amazon Polly AWS region. None uses AWS_POLLY_REGION then us-east-1.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally