Skip to main content

Overview

SilmaTTSService provides low-latency real-time text-to-speech Pipecat integration via a WebSocket API. It streams audio from SILMA TTS over a WebSocket you can play through any Pipecat transport. SILMA selects the language by model rather than by a language parameter:
  • silma-tts-v2-english — English
  • silma-tts-v2-msa — Modern Standard Arabic
  • silma-tts-v2-ksa — Arabic in the Saudi (Najdi) dialect
For an updated list of languages, please visit SILMA AI Products Pick a preset voice, or a voice you have cloned in your SILMA account.

Source Repository

Package source, the foundational example, and issue tracker

PyPI Package

The pipecat-silma package on PyPI

SILMA AI

Product overview, voices, and the TTS playground

API Keys

Create and manage your SILMA API keys

Installation

Install the community package. It is published separately from pipecat-ai:

Prerequisites

Account and API key

  1. Create an account at SILMA App
  2. Copy an API key from API Keys
Set it in the environment:

Configuration

str
default:"None"
SILMA API key. If omitted, the service reads SILMA_API_KEY.
SilmaTTSService.Settings
default:"None"
Model, voice, and prosody. See Settings. Every field is also available as a direct constructor argument.
str
default:"https://api.silma.ai/tts/v2"
Override this only for a non-production SILMA endpoint. The WebSocket URL is derived from it, so http:// becomes ws:// for a local mock server.
float
default:"20.0"
How often to ping an idle connection, in seconds. It has to stay comfortably inside the read timeout of whatever proxy fronts the API — lower it if yours is shorter than the default assumes. Getting it wrong is not fatal: the next utterance reopens the socket, at the cost of a reconnect on its first word.
int
default:"None"
SILMA renders 24 kHz audio and takes no sample-rate parameter, so the service pins its rate at 24000. Leave this unset; passing anything other than 24000 raises ValueError rather than mislabelling the audio. Let the output transport resample if it needs a different rate.

Settings

Pass these through SilmaTTSService.Settings(...). They can also be updated while the pipeline is running, with TTSUpdateSettingsFrame. creativity and speed are omitted from the request entirely unless you set them, so SILMA’s own defaults apply.

Models and voices

Voice catalogs and model coverage can change. See app.silma.ai or API specification for the current list.

Usage

To speak English instead of Arabic, change the model and pick an English voice:

Pronunciation hints

SILMA reads phone numbers, email addresses and links correctly when they are tagged in the text:
The API caps a request at 250 characters, so the service splits longer text on word boundaries and sends it as sequential requests over the same socket. The splitter keeps these tags intact, so a tag is never cut in half across two requests. Instruct your LLM to emit them — the foundational example shows how. Account-level pronunciation overrides configured at app.silma.ai/control apply when you pass both user_id and enable_server_pronunciation_overrides=True.

Cloned voices

Upload a voice under Custom Voices at app.silma.ai/voices, then pass its id together with your user id:
A cloned voice overrides the preset, so the voice you pair it with does not matter.

Interruptions

SilmaTTSService extends InterruptibleTTSService. SILMA’s protocol has no cancel message, so speech is stopped by dropping the socket and reconnecting — which the service does without blocking the frame that clears buffered audio, so a barge-in takes effect immediately rather than after the teardown completes.

Compatibility

Tested with Pipecat 1.8.1 (pipecat-ai>=1.8.1), on Python 3.11 and later.