tts-voice-creator-clone-and.../architecture/seed-autopick.md
mARTin-B78 b36423457b feat(design): auto-pick the best seed by scored candidates
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-04 16:37:58 +02:00

7 lines
1022 B
Markdown

# Seed auto-pick
- `POST /api/seed-autopick` (routes/tts.py) validates input (`core/seed_score.seed_list`: explicit seeds 0-9999 or `count` 1-16, default 8), then for each seed calls `_seed_finder_request_audio` in a worker thread (shared `_SEED_FINDER_VOICE_LOCK`, voices.json restored in its `finally`), scores it in a second thread and moves on. Per-candidate timeout 240 s; a timeout ends the run (the worker still holds the lock until it restores). Client disconnect is checked between candidates (cancel = abort the fetch).
- Scoring: `core/seed_score.py` (constants at top, formula in the docstring). Sub-scores come from `routes.stt._transcribe_audio` + `_word_accuracy` (imported lazily), `core.audio._loudness_info`, `core.audio.audio_problems`. First STT failure disables ASR for the rest of the run (`degraded: true`, `stt.note`).
- Never saves. The UI confirms via the existing `/api/tts-voice-seed`.
- Limits: sequential, so 16 candidates take minutes; audio returns base64 in the JSON (about 0.5 MB each).