diff options
| author | historia <historiavg@proton.me> | 2026-08-20 16:17:57 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-20 16:17:57 -0400 |
| commit | 4d3530f63730b47870d25629802c0c41f0c9ffae (patch) | |
| tree | 319311a69f7ace225a4ef0f8040fc22857c304b8 /converter/config.py | |
| parent | c2afb9d01b854bb709345c1b33bdba741daceb25 (diff) | |
| download | tts-audiobook-generator-4d3530f63730b47870d25629802c0c41f0c9ffae.tar.gz | |
feat: audio.cpp backend support
Diffstat (limited to 'converter/config.py')
| -rw-r--r-- | converter/config.py | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/converter/config.py b/converter/config.py index 9f4dd95..4cb5ab8 100644 --- a/converter/config.py +++ b/converter/config.py @@ -1,50 +1,58 @@ -"""Configuration for the audiobook converter. - -Edit these values to change voices and processing behavior. Everything -else (voice mode names, languages, speaker names, model ids, folders, -file formats) is fixed in the code where it is used. -""" - -# Server endpoints. Voice clone needs the Base-model demo, which is a -# separate server from the CustomVoice demo (that one only exposes -# /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 -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. +# Default output options +AUDIO_FORMAT = "m4b" +AUDIO_BITRATE = "128k" +LANGUAGE = "English" + +API_TIMEOUT = 600 # Timeout per chunk request in seconds +MAX_RETRIES = 3 # Attempts per chunk request +HEARTBEAT_INTERVAL_SECONDS = 30 # Print "still working" in console logs every N seconds + +# Words per TTS generation request. +# Note that qwen-tts-demo does no chunking at all, but faster-qwen-tts and +# audio.cpp may do chunking as well, so you may be needlessly double-chunking. 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 +# Default TTS backend. +# gradio: qwen-tts-demo +# faster: faster-qwen-tts +# audiocpp: audiocpp_server +# The --backend CLI flag overrides this +BACKEND = "gradio" -LANGUAGE = "English" +############################################################################### +# BACKEND 1: qwen-tts-demo (gradio) options # +############################################################################### -# 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 +# There are different API URLs for CustomVoice and Base models so you can run both at once +QWEN_API_URL = "http://127.0.0.1:7860" # CustomVoice model +CLONE_API_URL = "http://127.0.0.1:7861" # Base model -SPEAKER = "Vivian" +# Custom voice options +SPEAKER = "Vivian" #Vivian, Serena, Uncle_Fu, Dylan, Eric, Ryan, Aiden, Ono_Anna, Sohee INSTRUCT = "Speak naturally and clearly, as if reading a dramatic book to an adult audience." +# Don't clone with transcription, only use x-vector-only cloning. Generally "worse" 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. +# Randomization seed. -1 means randomize with every generation +# With SEED = -1 and CONSTANT_SEED = True, one random seed will be used for the entire audiobook. +# This may keep the voice slightly more consistent across chunk boundaries +SEED = -1 +CONSTANT_SEED = False + +############################################################################### +# BACKEND 2: faster-qwen-tts options # +############################################################################### +FASTER_API_URL = "http://127.0.0.1:8000" # faster-qwen3-tts server (Base model only) + +# Default voice if no --voice is passed FASTER_VOICE = "default" -AUDIO_FORMAT = "m4b" # Default output container -AUDIO_BITRATE = "128k" +############################################################################### +# BACKEND 3: audio.cpp options # +############################################################################### +AUDIOCPP_API_URL = "http://127.0.0.1:8080" # audio.cpp audiocpp_server + +# Model ids in the audio.cpp server.json config. +AUDIOCPP_MODEL_ID = "qwen"https://github.com/0xShug0/audio.cpp +AUDIOCPP_CLONE_MODEL_ID = "qwen-clone" |
