Commit Graph

5 Commits

Author SHA1 Message Date
Z User
a2e9bac081 fix: TTS logs + voices list — stream VALID_ROLES + file-based voice scan + v0.9.2
## 3 fixes

### 1. TTS logs not working in dashboard
The stream route (/api/services/[role]/stream) had its own VALID_ROLES
list that was missing 'tts'. Added 'tts' to the list.

### 2. Dashboard doesn't show voices
/api/tts/voices only queried the TTS API (http://tts:8000/v1/audio/voices).
If TTS was not running or the API didn't return custom voices, the list
was empty.

Rewrote /api/tts/voices to use 3 sources:
1. TTS API (if running)
2. voice_to_speaker.yaml (parse voice names from config file)
3. Scan gpu/tts/voices/ directory for .onnx and .wav files
   - .onnx files: ru_RU-irina-medium.onnx → 'irina'
   - .wav files: myvoice.wav → 'myvoice'
4. Always include defaults (alloy, echo, fable, onyx, nova, shimmer)

### 3. Voices not loading on page open
refreshVoices() was only called when ttsRunning was true. Changed to
always fetch on mount — the API now works even when TTS is stopped
because it reads from config files and directory.

## Version → 0.9.2

## After merge

```sh
git pull && sh build.sh
docker compose up -d --force-recreate dashboard
```

TTS tab should now show irina, denis, dmitri, ruslan in the voice
dropdown (even if TTS is stopped). TTS logs should work in Logs tab.
2026-10-29 23:39:55 +00:00
Z User
86e6daae07 fix: TTS custom entrypoint + Piper Russian voices + v0.9.0
## Root cause: voice not appearing + poor Russian quality

1. Mounting gpu/tts/config over /app/config created an EMPTY directory,
   overwriting the Docker image's built-in voice_to_speaker.yaml. Custom
   voices uploaded via the API were saved to this empty dir, but the
   default voices (alloy, nova, etc.) disappeared.

2. XTTSv2 (tts-1-hd) speaks Russian with an accent, wrong stress,
   swallows letters. It's English-trained multilingual — not ideal for
   Russian.

## Fix

### Custom entrypoint (gpu/tts/entrypoint.sh)
Instead of mounting an empty dir over /app/config, we use a custom
entrypoint that:
1. On first run, checks if voice_to_speaker.yaml exists in /app/config/
2. If not — tries to copy defaults from the Docker image
3. If that fails — creates a default config with:
   - Piper English voices (alloy, echo, fable, onyx, nova, shimmer)
   - Piper Russian voices (irina, denis) ← NEW
   - XTTS voices (alloy, echo, fable, onyx, nova, shimmer)
4. Also creates empty pre_process_map.yaml if missing
5. Then exec's the original python /app/app.py

### Piper Russian voices
- Added irina (female) and denis (male) to the default config
- Created download-ru-voices.sh script that downloads:
  irina, denis, dmitri, ruslan from HuggingFace (rhasspy/piper-voices)
- These are NATIVE Russian-trained voices — no accent, correct stress
- Use with model 'tts-1' (NOT 'tts-1-hd')

### compose.yaml
- Added mount: gpu/tts/entrypoint.sh → /app/custom-entrypoint.sh
- Changed entrypoint to use custom-entrypoint.sh

### TTSTab UI
- Added 'Russian voices' info section explaining:
  - tts-1 with irina/denis = natural Russian, no accent
  - tts-1-hd with XTTS = less natural for Russian
  - How to download Piper voices: sh gpu/tts/download-ru-voices.sh

### /api/tts/generate
- Accepts optional 'language' field (passed through to openedai-speech)
- Better error messages

## After merge

1. Build and recreate:
   docker compose --profile tts up -d --force-recreate tts

2. Download Russian Piper voices:
   sh gpu/tts/download-ru-voices.sh

3. Restart TTS again (so it picks up the voices):
   docker compose --profile tts restart tts

4. In TTS tab:
   - Model: tts-1 (Piper)
   - Voice: irina (female) or denis (male)
   - Type Russian text → natural, no accent!

Version → 0.9.0
2026-10-29 23:20:55 +00:00
Z User
c9ed8e0245 fix: TTS voice upload updates voice_to_speaker.yaml + language selector + v0.8.3
- compose.yaml: mount gpu/tts/config → /app/config for voice_to_speaker.yaml
- /api/tts/upload-voice: creates/updates voice_to_speaker.yaml with new voice entry
- TTSTab: language selector (default Russian), passed to API
- /api/tts/generate: arrayBuffer instead of streaming for reliability
2026-10-29 23:09:05 +00:00
Z User
dca0fcc59f fix: TTS logs in Logs tab + TTS generate buffer fix + Russian voice hint + v0.8.2
## Fixes

### 1. TTS logs in Logs tab
Added 'tts' to the logs target selector in the Logs tab. Now you can
stream docker logs from the TTS container.

### 2. TTS generate fetch failed
Changed /api/tts/generate from streaming res.body directly to
res.arrayBuffer() first, then returning the buffer. Next.js sometimes
cuts off streaming responses from server-side fetch — buffering avoids
this.

Also improved error messages:
- ECONNREFUSED / fetch failed → 'TTS container is not running...'
- ENOTFOUND → 'TTS container not found on Docker network...'

### 3. Russian voice accent
Built-in voices (alloy, nova, shimmer) are English-trained and will
speak Russian with an accent. Added a prominent hint in the TTS tab
explaining that for natural Russian, you need to upload a custom WAV
sample of a Russian speaker.

## Version → 0.8.2
2026-10-29 21:42:08 +00:00
Z User
0610f09eb1 feat: TTS dashboard tab — generate, voice upload, start/stop controls + v0.8.0
## What

New TTS tab in the dashboard for text-to-speech generation.

### Backend

- `GET /api/tts/voices` — proxies openedai-speech /v1/audio/voices
- `POST /api/tts/generate` — proxies /v1/audio/speech, streams audio back
- `POST /api/tts/upload-voice` — uploads custom voice sample (WAV/MP3/FLAC)
  to gpu/tts/voices/ for XTTSv2 voice cloning
- `GET /api/tts/upload-voice` — lists voice files on disk

### Frontend — TTSTab component

- **Start/Stop/Restart TTS** buttons (uses /api/services/tts)
- **Model select**: tts-1 (Piper, faster) / tts-1-hd (XTTSv2, better quality)
- **Voice select**: lists available voices from /api/tts/voices
- **Format select**: MP3 / WAV / Opus / FLAC
- **Speed slider**: 0.25x — 4.0x
- **Text input**: multi-line, char count, Ctrl+Enter to generate
- **Audio output**: inline audio player + download link
- **Custom voice upload**: drag a WAV sample → saved to gpu/tts/voices/
  → restart TTS to apply. XTTSv2 supports Russian.

### Recommended Russian voices

For natural Russian female voices with XTTSv2:
1. Find a clean 10-20s WAV sample of a female Russian speaker
   (mono, 22050 Hz, no background noise)
2. Upload via the 'Upload voice sample' button
3. Restart TTS
4. Select the new voice from the dropdown
5. Generate with Russian text

Good sources for voice samples:
- Record yourself or a friend
- Use a clip from a Russian audiobook (lib.ru)
- Use a clip from a Russian podcast

The built-in 'nova' and 'shimmer' voices (female-sounding) also work
with Russian text on tts-1-hd, though they're English-trained.

## Version → 0.8.0

## After merge

```sh
git pull && sh build.sh
docker compose up -d --force-recreate dashboard
docker compose --profile tts up -d tts
```

Open TTS tab → Start TTS → type Russian text → Generate.
2026-10-29 21:09:45 +00:00