aboutsummaryrefslogtreecommitdiff
path: root/converter/config.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-19 02:10:13 -0400
committerhistoria <historiavg@proton.me>2026-08-19 02:10:13 -0400
commit11384921323f7b08271be0607d8df774489a1f7d (patch)
tree90b78855cce256dea077ed72dd822ae1fbb1696f /converter/config.py
parenta89daa1af05e2816f970d6a7b28a07df4f102f7d (diff)
downloadtts-audiobook-generator-11384921323f7b08271be0607d8df774489a1f7d.tar.gz
fix: reduce chunk size to 40
Diffstat (limited to 'converter/config.py')
-rw-r--r--converter/config.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/converter/config.py b/converter/config.py
index efec0dd..dcec145 100644
--- a/converter/config.py
+++ b/converter/config.py
@@ -123,8 +123,9 @@ FASTER_TTS_API_URL = "http://127.0.0.1:8000"
# name is unknown, so a mismatch here is easy to miss.
FASTER_TTS_VOICE = "default"
FASTER_TTS_SAMPLE_RATE = 24000 # Qwen3-TTS 12Hz codec output rate
-# The Gradio demo sub-chunked text server-side (~200 chars); the faster server
-# takes one generation per request, so long chunks are sub-chunked client-side.
+# Safety net: the faster server takes one generation per request, so any
+# chunk longer than this is sub-chunked client-side (a no-op at the default
+# CHUNK_SIZE_WORDS above; kept in case the chunk size is ever raised).
FASTER_SUBCHUNK_WORDS = 40 # ~200 chars per request
FASTER_HTTP_TIMEOUT = 300 # Seconds before a speech request times out
FASTER_SUBCHUNK_RETRIES = 3 # Attempts per sub-chunk request
@@ -138,8 +139,14 @@ AUDIOBOOKS_FOLDER = BASE_DIR / "output" # Output folder
CHUNKS_FOLDER = BASE_DIR / "chunks" # Scratch space for per-chunk audio (cleaned per book)
LOGS_FOLDER = BASE_DIR / "logs"
-CHUNK_SIZE_WORDS = 1500 # Words per TTS chunk
-MIN_DELAY_BETWEEN_CHUNKS = 1 # Seconds between API calls
+# Words per TTS generation request. Each API call is ONE model generation:
+# long generations lose prosody, can degrade into garbled audio, and text
+# past the model's token limit is never spoken. ~40 words (~200 chars) is
+# the per-request length the old qwen-tts demo enforced server-side.
+CHUNK_SIZE_WORDS = 40
+# Pause between API calls (rate-limit protection for hosted demos; a local
+# server needs no delay).
+MIN_DELAY_BETWEEN_CHUNKS = 0
HEARTBEAT_INTERVAL_SECONDS = 30 # Print "still working" this often during a chunk
# =============================================================================