TTS voice cloning Discord bot
0
stars
32
commits
Python
primary language
May 19, 2026
updated
TTS voice cloning Discord bot.
Two TTS engines are supported:
# Install dependencies (requires CUDA GPU)
uv sync
# Start Postgres
make docker-db
# Run database migrations
make migrate
# Copy and configure environment
cp .env.example .env
# Build dashboard
make frontend
# Start dev server at http://localhost:8000
make dev
The bot runs inside the FastAPI process. Starting the API starts the bot. See docs/bot-setup.md for Discord Developer Portal setup.
| Command | Description |
|---|---|
/say <character> <text> | Generate TTS and play it in a voice channel |
/voices | List available character voices |
The Svelte dashboard is served at http://localhost:8000:
Register a character with a 5-30 second WAV reference clip. Around 10 seconds of clean mono speech at 22050 Hz works best.
# Upload via API
curl -X POST "http://localhost:8000/api/characters?name=my-character" \
-F "audio=@/path/to/reference.wav"
# Or place manually and restart
# voices/my-character/reference.wav
Train a LoRA adapter from multiple audio clips for higher quality. See docs/lora-tuning.md for the full guide.
export CUDA_VISIBLE_DEVICES=0
export CHARACTER=my_character
# Prepare audio clips (3-13s each, normalized)
make prepare-audio ARGS="raw_audio/$CHARACTER/ prepared/$CHARACTER/"
# Transcribe with Whisper
make transcribe ARGS="prepared/$CHARACTER/ --model large"
# Train LoRA adapter
make train-lora ARGS="$CHARACTER prepared/$CHARACTER/ --device cuda --epochs 1"
The voice registry auto-detects adapter files (adapter_config.json) and routes to the Orpheus engine.
OpenAPI docs at http://localhost:8000/docs.
| Method | Path | Description |
|---|---|---|
GET | /health | DB, TTS model, and GPU status |
GET | /api/status | Bot connection, guilds, config |
GET | /api/metrics | Request counts, top users, queue depth |
GET | /api/system/stats | GPU VRAM, engine status, cache stats, uptime |
| Method | Path | Description |
|---|---|---|
POST | /api/tts/generate | Generate speech as WAV (cached) |
POST | /api/tts/stream | Stream speech in chunks |
| Method | Path | Description |
|---|---|---|
GET | /api/characters | List all characters |
POST | /api/characters | Create character (name + audio upload) |
PUT | /api/characters/{id}/tuning | Update per-character TTS parameters |
DELETE | /api/characters/{id} | Delete character and reference audio |
| Method | Path | Description |
|---|---|---|
GET | /api/queue | Current queue state |
POST | /api/queue/{id}/cancel | Cancel a pending request |
POST | /api/queue/{id}/bump | Move request to front |
| Method | Path | Description |
|---|---|---|
GET | /api/requests | List requests (filterable, paginated) |
GET | /api/requests/{id} | Get single request |
| Method | Path | Description |
|---|---|---|
GET | /api/users | List all users |
POST | /api/users/{id}/blacklist | Toggle blacklist |
GET | /api/users/{id}/requests | User's request history |
| Method | Path | Description |
|---|---|---|
GET | /api/cache | Cache state with all entries |
POST | /api/cache/toggle | Enable/disable cache |
POST | /api/cache/flush | Clear all entries |
DELETE | /api/cache/{key} | Delete single entry |
GET | /api/cache/{key}/download | Download cached WAV |
| Method | Path | Description |
|---|---|---|
GET | /api/audit | Audit log (filterable) |
GET | /api/config | Current settings (secrets redacted) |
| Variable | Default | Description |
|---|---|---|
DOPPELGANGER_DEBUG | false | Enable debug logging |
DOPPELGANGER_HOST | 0.0.0.0 | Server bind host |
DOPPELGANGER_PORT | 8000 | Server bind port |
DOPPELGANGER_ALLOWED_ORIGINS | ["*"] | CORS allowed origins |
DOPPELGANGER_VOICES_DIR | voices | Character voice files directory |
DOPPELGANGER_CACHE_MAX_SIZE | 100 | Max audio cache entries |
| Variable | Default | Description |
|---|---|---|
DOPPELGANGER_DATABASE__HOST | localhost | PostgreSQL host |
DOPPELGANGER_DATABASE__PORT | 5432 | PostgreSQL port |
DOPPELGANGER_DATABASE__USER | doppelganger | Database user |
DOPPELGANGER_DATABASE__PASSWORD | doppelganger | Database password |
DOPPELGANGER_DATABASE__NAME | doppelganger | Database name |
DOPPELGANGER_DATABASE__POOL_SIZE | 5 | Connection pool size |
DOPPELGANGER_DATABASE__POOL_MAX_OVERFLOW | 10 | Max pool overflow |
| Variable | Default | Description |
|---|---|---|
DOPPELGANGER_CHATTERBOX__DEVICE | cuda | Torch device |
DOPPELGANGER_CHATTERBOX__EXAGGERATION | 0.3 | Vocal expressiveness (0.0-1.0) |
DOPPELGANGER_CHATTERBOX__CFG_WEIGHT | 3.0 | Classifier-free guidance strength |
DOPPELGANGER_CHATTERBOX__TEMPERATURE | 0.75 | Sampling temperature |
DOPPELGANGER_CHATTERBOX__CHUNK_SIZE | 50 | Tokens per streaming chunk |
| Variable | Default | Description |
|---|---|---|
DOPPELGANGER_ORPHEUS__ENABLED | true | Enable Orpheus engine |
DOPPELGANGER_ORPHEUS__VLLM_BASE_URL | http://localhost:8001/v1 | vLLM API endpoint |
DOPPELGANGER_ORPHEUS__TEMPERATURE | 0.6 | Generation temperature |
DOPPELGANGER_ORPHEUS__TOP_P | 0.95 | Nucleus sampling threshold |
DOPPELGANGER_ORPHEUS__REPETITION_PENALTY | 1.1 | Repetition penalty |
DOPPELGANGER_ORPHEUS__FREQUENCY_PENALTY | 0.0 | Frequency penalty |
HUGGING_FACE_HUB_TOKEN | - | HF token for model access |
| Variable | Default | Description |
|---|---|---|
DOPPELGANGER_DISCORD__TOKEN | - | Bot token (required for bot) |
DOPPELGANGER_DISCORD__GUILD_ID | - | Guild ID for slash commands |
DOPPELGANGER_DISCORD__REQUIRED_ROLE_ID | - | Optional required role |
DOPPELGANGER_DISCORD__COOLDOWN_SECONDS | 5 | Cooldown between plays |
DOPPELGANGER_DISCORD__ENTRANCE_SOUND | - | Optional WAV on channel join |
DOPPELGANGER_DISCORD__MAX_TEXT_LENGTH | 255 | Max chars per request |
DOPPELGANGER_DISCORD__MAX_QUEUE_DEPTH | 20 | Max pending requests |
DOPPELGANGER_DISCORD__REQUESTS_PER_MINUTE | 3 | Per-user rate limit |
make test # All tests (unit + integration)
make test-unit # Unit tests only (no Docker)
make test-integration # Integration tests (needs Docker)
make check # Format + lint + type-check
make fmt # Format with ruff
make lint # Lint with ruff
make docker-db # PostgreSQL only
make docker-up # API + PostgreSQL
make docker-down # Stop all containers
make vllm # Start vLLM for Orpheus
make psql # Connect to database
30 commits
2 commits
Python
75.9%
Svelte
20.2%
TypeScript
1.9%
SCSS
1.2%
TTS voice cloning Discord bot
0
stars
32
commits
Python
primary language
May 19, 2026
updated
TTS voice cloning Discord bot.
Two TTS engines are supported:
# Install dependencies (requires CUDA GPU)
uv sync
# Start Postgres
make docker-db
# Run database migrations
make migrate
# Copy and configure environment
cp .env.example .env
# Build dashboard
make frontend
# Start dev server at http://localhost:8000
make dev
The bot runs inside the FastAPI process. Starting the API starts the bot. See docs/bot-setup.md for Discord Developer Portal setup.
| Command | Description |
|---|---|
/say <character> <text> | Generate TTS and play it in a voice channel |
/voices | List available character voices |
The Svelte dashboard is served at http://localhost:8000:
Register a character with a 5-30 second WAV reference clip. Around 10 seconds of clean mono speech at 22050 Hz works best.
# Upload via API
curl -X POST "http://localhost:8000/api/characters?name=my-character" \
-F "audio=@/path/to/reference.wav"
# Or place manually and restart
# voices/my-character/reference.wav
Train a LoRA adapter from multiple audio clips for higher quality. See docs/lora-tuning.md for the full guide.
export CUDA_VISIBLE_DEVICES=0
export CHARACTER=my_character
# Prepare audio clips (3-13s each, normalized)
make prepare-audio ARGS="raw_audio/$CHARACTER/ prepared/$CHARACTER/"
# Transcribe with Whisper
make transcribe ARGS="prepared/$CHARACTER/ --model large"
# Train LoRA adapter
make train-lora ARGS="$CHARACTER prepared/$CHARACTER/ --device cuda --epochs 1"
The voice registry auto-detects adapter files (adapter_config.json) and routes to the Orpheus engine.
OpenAPI docs at http://localhost:8000/docs.
| Method | Path | Description |
|---|---|---|
GET | /health | DB, TTS model, and GPU status |
GET | /api/status | Bot connection, guilds, config |
GET | /api/metrics | Request counts, top users, queue depth |
GET | /api/system/stats | GPU VRAM, engine status, cache stats, uptime |
| Method | Path | Description |
|---|---|---|
POST | /api/tts/generate | Generate speech as WAV (cached) |
POST | /api/tts/stream | Stream speech in chunks |
| Method | Path | Description |
|---|---|---|
GET | /api/characters | List all characters |
POST | /api/characters | Create character (name + audio upload) |
PUT | /api/characters/{id}/tuning | Update per-character TTS parameters |
DELETE | /api/characters/{id} | Delete character and reference audio |
| Method | Path | Description |
|---|---|---|
GET | /api/queue | Current queue state |
POST | /api/queue/{id}/cancel | Cancel a pending request |
POST | /api/queue/{id}/bump | Move request to front |
| Method | Path | Description |
|---|---|---|
GET | /api/requests | List requests (filterable, paginated) |
GET | /api/requests/{id} | Get single request |
| Method | Path | Description |
|---|---|---|
GET | /api/users | List all users |
POST | /api/users/{id}/blacklist | Toggle blacklist |
GET | /api/users/{id}/requests | User's request history |
| Method | Path | Description |
|---|---|---|
GET | /api/cache | Cache state with all entries |
POST | /api/cache/toggle | Enable/disable cache |
POST | /api/cache/flush | Clear all entries |
DELETE | /api/cache/{key} | Delete single entry |
GET | /api/cache/{key}/download | Download cached WAV |
| Method | Path | Description |
|---|---|---|
GET | /api/audit | Audit log (filterable) |
GET | /api/config | Current settings (secrets redacted) |
| Variable | Default | Description |
|---|---|---|
DOPPELGANGER_DEBUG | false | Enable debug logging |
DOPPELGANGER_HOST | 0.0.0.0 | Server bind host |
DOPPELGANGER_PORT | 8000 | Server bind port |
DOPPELGANGER_ALLOWED_ORIGINS | ["*"] | CORS allowed origins |
DOPPELGANGER_VOICES_DIR | voices | Character voice files directory |
DOPPELGANGER_CACHE_MAX_SIZE | 100 | Max audio cache entries |
| Variable | Default | Description |
|---|---|---|
DOPPELGANGER_DATABASE__HOST | localhost | PostgreSQL host |
DOPPELGANGER_DATABASE__PORT | 5432 | PostgreSQL port |
DOPPELGANGER_DATABASE__USER | doppelganger | Database user |
DOPPELGANGER_DATABASE__PASSWORD | doppelganger | Database password |
DOPPELGANGER_DATABASE__NAME | doppelganger | Database name |
DOPPELGANGER_DATABASE__POOL_SIZE | 5 | Connection pool size |
DOPPELGANGER_DATABASE__POOL_MAX_OVERFLOW | 10 | Max pool overflow |
| Variable | Default | Description |
|---|---|---|
DOPPELGANGER_CHATTERBOX__DEVICE | cuda | Torch device |
DOPPELGANGER_CHATTERBOX__EXAGGERATION | 0.3 | Vocal expressiveness (0.0-1.0) |
DOPPELGANGER_CHATTERBOX__CFG_WEIGHT | 3.0 | Classifier-free guidance strength |
DOPPELGANGER_CHATTERBOX__TEMPERATURE | 0.75 | Sampling temperature |
DOPPELGANGER_CHATTERBOX__CHUNK_SIZE | 50 | Tokens per streaming chunk |
| Variable | Default | Description |
|---|---|---|
DOPPELGANGER_ORPHEUS__ENABLED | true | Enable Orpheus engine |
DOPPELGANGER_ORPHEUS__VLLM_BASE_URL | http://localhost:8001/v1 | vLLM API endpoint |
DOPPELGANGER_ORPHEUS__TEMPERATURE | 0.6 | Generation temperature |
DOPPELGANGER_ORPHEUS__TOP_P | 0.95 | Nucleus sampling threshold |
DOPPELGANGER_ORPHEUS__REPETITION_PENALTY | 1.1 | Repetition penalty |
DOPPELGANGER_ORPHEUS__FREQUENCY_PENALTY | 0.0 | Frequency penalty |
HUGGING_FACE_HUB_TOKEN | - | HF token for model access |
| Variable | Default | Description |
|---|---|---|
DOPPELGANGER_DISCORD__TOKEN | - | Bot token (required for bot) |
DOPPELGANGER_DISCORD__GUILD_ID | - | Guild ID for slash commands |
DOPPELGANGER_DISCORD__REQUIRED_ROLE_ID | - | Optional required role |
DOPPELGANGER_DISCORD__COOLDOWN_SECONDS | 5 | Cooldown between plays |
DOPPELGANGER_DISCORD__ENTRANCE_SOUND | - | Optional WAV on channel join |
DOPPELGANGER_DISCORD__MAX_TEXT_LENGTH | 255 | Max chars per request |
DOPPELGANGER_DISCORD__MAX_QUEUE_DEPTH | 20 | Max pending requests |
DOPPELGANGER_DISCORD__REQUESTS_PER_MINUTE | 3 | Per-user rate limit |
make test # All tests (unit + integration)
make test-unit # Unit tests only (no Docker)
make test-integration # Integration tests (needs Docker)
make check # Format + lint + type-check
make fmt # Format with ruff
make lint # Lint with ruff
make docker-db # PostgreSQL only
make docker-up # API + PostgreSQL
make docker-down # Stop all containers
make vllm # Start vLLM for Orpheus
make psql # Connect to database
30 commits
2 commits
Python
75.9%
Svelte
20.2%
TypeScript
1.9%
SCSS
1.2%