diff options
| author | historia <historiavg@proton.me> | 2026-08-19 05:13:36 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-19 05:13:36 -0400 |
| commit | 94ddbb0634022a6e5209b5221c057228ec3d1418 (patch) | |
| tree | d7892e758cad10336816695166c511f7a9689704 /converter/config.py | |
| parent | 9d4d7ef806c17387af9778725cd65a5e7ed10e39 (diff) | |
| download | tts-audiobook-generator-94ddbb0634022a6e5209b5221c057228ec3d1418.tar.gz | |
feat: reuse one seed per run for consistent voice across chunks
Diffstat (limited to 'converter/config.py')
| -rw-r--r-- | converter/config.py | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/converter/config.py b/converter/config.py index a19ac63..9f4dd95 100644 --- a/converter/config.py +++ b/converter/config.py @@ -10,53 +10,41 @@ file formats) is fixed in the code where it is used. # /run_instruct); the faster backend is the OpenAI-compatible server from # the faster-qwen3-tts repository. QWEN_API_URL = "http://127.0.0.1:7860" # CustomVoice demo -VOICE_CLONE_API_URL = "http://127.0.0.1:7861" # Base-model demo -FASTER_TTS_API_URL = "http://127.0.0.1:8000" # faster-qwen3-tts server +CLONE_API_URL = "http://127.0.0.1:7861" # Base-model demo +FASTER_API_URL = "http://127.0.0.1:8000" # faster-qwen3-tts server # Words per TTS generation request. Each request is ONE model generation: # the voice is re-sampled per request (every chunk boundary can drift # slightly), while over-long generations lose prosody and can turn garbled. # ~250 words is ~1.5-2 minutes of speech: few voice boundaries while # staying inside both servers' generation caps. -CHUNK_SIZE_WORDS = 250 - -# Hard ceiling on words per request, regardless of CHUNK_SIZE_WORDS. Both -# TTS servers silently truncate audio when a single generation exceeds its -# cap (~2.5 min for the faster backend's static KV cache, ~11 min for the -# Gradio demo) without reporting any error, so larger requests are always -# split client-side. Keep a margin below ~300 words to survive slow -# narration on the faster backend. -MAX_REQUEST_WORDS = 250 - -# Duration sanity check: a response whose audio is far shorter than its -# word count implies is treated as silently truncated, fails the request, -# and goes through the normal retry logic. 150 wpm is a typical spoken -# pace; the ratio is set low (0.5) so only gross truncation trips it. -ESTIMATED_WORDS_PER_MINUTE = 150 -MIN_AUDIO_DURATION_RATIO = 0.5 -MIN_WORDS_FOR_DURATION_CHECK = 10 - -VOICE_CLONE_MAX_CHUNK_CHARS = 200 # Server-side re-chunking limit for clone requests -VOICE_CLONE_CHUNK_GAP = 0 # Pause (seconds) between server-side clone chunks - -MIN_DELAY_BETWEEN_CHUNKS = 0 # Pause between API calls (rate-limit protection; local servers need none) +CHUNK_SIZE = 250 API_TIMEOUT = 600 # Seconds before an API call times out (a ~250-word request can take minutes on the Gradio demo) MAX_RETRIES = 3 # Attempts per chunk request HEARTBEAT_INTERVAL_SECONDS = 30 # Print "still working" this often during a chunk LANGUAGE = "English" + +# Seed sent to the TTS servers (only the endpoints that accept one; the +# primary /run_instruct and /run_voice_clone endpoints and the faster +# backend never receive a seed). -1 means "randomize per generation". +# With CONSTANT_SEED = True and SEED = -1, one random seed is drawn at +# startup and reused for every request of the run, keeping the voice +# consistent across chunk boundaries; set SEED to a fixed number to also +# reproduce the same voice across runs. SEED = -1 +CONSTANT_SEED = True -CUSTOM_VOICE_SPEAKER = "Vivian" -CUSTOM_VOICE_INSTRUCT = "Speak naturally and clearly, as if reading a dramatic book to an adult audience." +SPEAKER = "Vivian" +INSTRUCT = "Speak naturally and clearly, as if reading a dramatic book to an adult audience." -VOICE_CLONE_USE_XVECTOR_ONLY = False +XVECTOR_ONLY = False # Must match a key in the faster server's voices.json ("default" when the # server was launched with --ref-audio). The server silently falls back to # its first voice for unknown names. -FASTER_TTS_VOICE = "default" +FASTER_VOICE = "default" AUDIO_FORMAT = "m4b" # Default output container AUDIO_BITRATE = "128k" |
