Speechmatics TTS client that synthesizes text to audio via HTTP API.
# Source: https://github.com/livekit/agents | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations
import asyncio
import os
from dataclasses import dataclass, replace
import aiohttp
from livekit.agents import (
APIConnectionError,
APIConnectOptions,
APIStatusError,
APITimeoutError,
tokenize,
tts,
utils,
)
from livekit.agents.types import (
DEFAULT_API_CONNECT_OPTIONS,
NOT_GIVEN,
NotGivenOr,
)
from livekit.agents.utils import is_given
from .utils import get_tts_url
BASE_URL = "https://preview.tts.speechmatics.com"
NUM_CHANNELS = 1
DEFAULT_VOICE = "sarah"
@dataclass
class _TTSOptions:
voice: str
sample
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key