Skip to content

Latest commit

History

200 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

TTS

A FastAPI-based service for local, high-speed neural text-to-speech synthesis. Supports Piper and Kokoro backends.

tts_preview.mov

Installation

# Install system requirements
sudo apt install ffmpeg
# Install python dependencies
python3 src/setup.py
source src/tts-venv/bin/activate

Usage

Start the service:

cd src/
python app.py

Python Example:

importrequests# Generate speech with an API keyresponse=requests.post(
"http://localhost:47100/api/tts",
headers={"X-API-Key": "secret-key"},
json={
"text": "Hello! {airhorn} Welcome.",
"voice": "en_US-ryan-high"
}
)
# Save the audio outputwithopen("speech.mp3", "wb") asf:
f.write(response.content)

Endpoints

All routes are served under the /api prefix.

Synthesis

MethodPathDescription
POST/api/ttsSynthesize speech from a JSON body
GET/api/ttsSynthesize speech from query params
POST/api/tts_batchSynthesize and concatenate multiple text and SFX parts
GET/api/voicesList available voices
POST/api/reloadReload voices from disk (admin)
GET/api/healthzHealth check
GET/api/metricsSynthesis metrics

Voice aliases

MethodPathDescription
GET/api/aliasesList voice aliases (admin)
POST/api/aliasesCreate or update a voice alias (admin)
DELETE/api/aliases/{name}Delete a voice alias (admin)

Sounds

MethodPathDescription
GET/api/soundsList sound effects and aliases
POST/api/sfx_aliasesCreate or update an SFX alias (admin)
DELETE/api/sfx_aliases/{name}Delete an SFX alias (admin)

Queue

MethodPathDescription
POST/api/pushQueue a TTS request
GET/api/pullPull and remove the next queued item
GET/api/peekView the next queued item without removing it (mod)
DELETE/api/queue/{qid}Remove a queued item by id (mod)

Auth & session

MethodPathDescription
POST/api/panel/loginLog in with a role key
POST/api/panel/logoutClear the session
GET/api/panel/statusGet current session roles
GET/api/auth/loginStart OAuth login with a provider
GET/api/auth/callbackOAuth provider redirect callback
GET/api/auth/meGet the OAuth identity in the session
GET/api/auth/mappingsList OAuth-to-role mappings (admin)
POST/api/auth/mappingMap an OAuth account to a role (admin)
DELETE/api/auth/mapping/{provider}/{remote}Delete an OAuth mapping (admin)

Overlay

MethodPathDescription
GET/api/overlayServe the overlay page, optionally for an embed
POST/api/overlay/tokenMint an overlay access token (admin)
GET/api/overlay/tokensList overlay tokens (admin)
DELETE/api/overlay/token/{jti}Revoke an overlay token (admin)
POST/api/overlay/embedCreate an overlay embed (admin)
GET/api/overlay/embedsList overlay embeds (admin)
DELETE/api/overlay/embed/{embed_id}Delete an overlay embed (admin)

Moderation

MethodPathDescription
POST/api/mod/maskMask URLs, emojis, and slurs in text
GET/api/mod/listList moderation terms (mod)
POST/api/mod/addAdd a moderation term (mod)
POST/api/mod/removeRemove a moderation term (mod)
POST/api/mod/reloadReload moderation terms (mod)
GET/api/mod/modeGet the current censor mode (mod)
POST/api/mod/modeSet the censor mode (mod)
GET/api/mod/testTest moderation on a string (mod)

About

Local neural text-to-speech service with Piper and Kokoro backends

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages