diff options
| author | historia <historiavg@proton.me> | 2026-08-21 14:28:42 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-21 14:28:42 -0400 |
| commit | 9d2c24edb983e458b0fbb9f065fbbda79c19ca26 (patch) | |
| tree | 8286decf2080bbd61c812dfab5d7dbe1ad1f94d5 /converter | |
| parent | e5c722e9fc67f20c1545f79bb4bbc0188dea7d1f (diff) | |
| download | tts-audiobook-generator-9d2c24edb983e458b0fbb9f065fbbda79c19ca26.tar.gz | |
rename project tts-audiobook generator, doc cleanup
Diffstat (limited to 'converter')
| -rw-r--r-- | converter/__init__.py | 2 | ||||
| -rw-r--r-- | converter/config.py | 10 | ||||
| -rw-r--r-- | converter/converter.py | 14 | ||||
| -rw-r--r-- | converter/tts.py | 18 |
4 files changed, 22 insertions, 22 deletions
diff --git a/converter/__init__.py b/converter/__init__.py index 80735d1..86a827f 100644 --- a/converter/__init__.py +++ b/converter/__init__.py @@ -1 +1 @@ -"""Qwen-based audiobook converter package.""" +"""TTS audiobook generator package.""" diff --git a/converter/config.py b/converter/config.py index 8e60250..d15efa5 100644 --- a/converter/config.py +++ b/converter/config.py @@ -8,20 +8,20 @@ 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 (client-side chunking). -# The gradio and faster backends always chunk with this size +# The qwen and faster backends always chunk with this size # The audio.cpp backend chunks long text itself, so this is ignored # by default with that backend. Force chunking with --chunk CHUNK_SIZE = 250 # Default TTS backend. -# gradio: qwen-tts-demo -# faster: faster-qwen-tts # audiocpp: audiocpp_server +# qwen: qwen-tts-demo +# faster: faster-qwen-tts # The --backend CLI flag overrides this -BACKEND = "gradio" +BACKEND = "audiocpp" ############################################################################### -# BACKEND 1: qwen-tts-demo (gradio) options # +# BACKEND 1: qwen-tts-demo (qwen) options # ############################################################################### # There are different API URLs for CustomVoice and Base models so you can run both at once diff --git a/converter/converter.py b/converter/converter.py index 4da3626..3915fe4 100644 --- a/converter/converter.py +++ b/converter/converter.py @@ -18,7 +18,7 @@ from .tts import ( BACKENDS, BACKEND_AUDIOCPP, BACKEND_FASTER, - BACKEND_GRADIO, + BACKEND_QWEN, MODEL_SIZE, VOICE_MODE_CLONE, VOICE_MODE_CUSTOM, @@ -131,12 +131,12 @@ def prompt_overwrite(existing: List[Path], output_name: str) -> bool: class AudiobookConverter: - """Audiobook converter using the Qwen TTS API.""" + """Audiobook converter using a local TTS API.""" def __init__(self, voice_mode: str = VOICE_MODE_CUSTOM, voice_clone_ref_audio: Optional[str] = None, voice_clone_ref_text: Optional[str] = None, skip_transcription: bool = False, speed: float = 1.0, single_file: bool = False, output_format: str = config.AUDIO_FORMAT, - language: Optional[str] = None, backend: str = BACKEND_GRADIO, + language: Optional[str] = None, backend: str = config.BACKEND, voice: Optional[str] = None, debug: bool = False, chunk: bool = False, model_id: Optional[str] = None): if speed <= 0: @@ -158,7 +158,7 @@ class AudiobookConverter: self.backend = backend self.voice = voice self.debug = bool(debug) - # Client-side chunking: the gradio and faster backends always chunk + # Client-side chunking: the qwen and faster backends always chunk # (their servers do one generation per request and silently truncate # long text). The audio.cpp server chunks long text itself, so it # defaults to one request per chapter; --chunk forces client-side @@ -192,7 +192,7 @@ class AudiobookConverter: f"Unknown voice mode: {self.voice_mode!r} " f"(expected one of {VOICE_MODES})" ) - if self.voice_mode == VOICE_MODE_CLONE and self.backend == BACKEND_GRADIO: + if self.voice_mode == VOICE_MODE_CLONE and self.backend == BACKEND_QWEN: if not self.voice_clone_ref_audio: raise ValueError( "Voice Clone mode requires a reference audio file. " @@ -464,7 +464,7 @@ class AudiobookConverter: def _chapter_chunks(self, text: str) -> List[str]: """Split chapter text into TTS requests. - Client-side chunking splits into CHUNK_SIZE-word chunks (gradio and + Client-side chunking splits into CHUNK_SIZE-word chunks (qwen and faster always; audio.cpp only with --chunk). Otherwise (audio.cpp default) the whole text is one request and the server does its own long-form chunking. @@ -575,7 +575,7 @@ class AudiobookConverter: def _print_banner(self) -> None: """Print the startup summary for the selected backend.""" print("=" * 70) - print("QWEN-BASED AUDIOBOOK CONVERTER") + print("TTS AUDIOBOOK GENERATOR") print("=" * 70) print(f"Books folder: {BOOKS_FOLDER}") print(f"Output folder: {AUDIOBOOKS_FOLDER}") diff --git a/converter/tts.py b/converter/tts.py index 83284a7..9b54cf4 100644 --- a/converter/tts.py +++ b/converter/tts.py @@ -1,6 +1,6 @@ """Client wrappers for the TTS backends. -QwenTTSClient talks to the Qwen3-TTS Gradio demos (custom voice / voice clone). +QwenTTSClient talks to the Qwen3-TTS demo server (custom voice / voice clone). FasterTTSClient talks to the OpenAI-compatible server from the faster-qwen3-tts repository (voice cloning only; the reference voice is configured server-side — see the "Faster backend" section of the README). @@ -40,10 +40,10 @@ VOICE_MODE_CLONE = "voice_clone" VOICE_MODES = (VOICE_MODE_CUSTOM, VOICE_MODE_CLONE) # TTS backends (re-exported for the CLI and the converter orchestrator). -BACKEND_GRADIO = "gradio" +BACKEND_QWEN = "qwen" BACKEND_FASTER = "faster" BACKEND_AUDIOCPP = "audiocpp" -BACKENDS = (BACKEND_GRADIO, BACKEND_FASTER, BACKEND_AUDIOCPP) +BACKENDS = (BACKEND_AUDIOCPP, BACKEND_QWEN, BACKEND_FASTER) # Languages understood by the Qwen3-TTS API. Display names must match the # demo dropdown exactly (the demo silently falls back to "Auto" for @@ -188,7 +188,7 @@ def _resolve_request_seed() -> int: def speaker_display_name() -> str: - """Return the Gradio display name for the configured custom speaker.""" + """Return the display name for the configured custom speaker.""" return SPEAKER_DISPLAY_NAMES.get( config.SPEAKER.lower(), config.SPEAKER) @@ -343,7 +343,7 @@ class _BaseTTSClient: class QwenTTSClient(_BaseTTSClient): - """Generates audio chunks through a Qwen3-TTS Gradio server.""" + """Generates audio chunks through a Qwen3-TTS demo server.""" def __init__(self, voice_mode: str = "custom_voice", voice_clone_ref_audio: Optional[str] = None, voice_clone_ref_text: Optional[str] = None, skip_transcription: bool = False, @@ -392,7 +392,7 @@ class QwenTTSClient(_BaseTTSClient): except Exception as exc: raise RuntimeError( f"Qwen API initialization failed at {api_url}: {exc}. " - "Make sure the Qwen Gradio server is running and reachable, and that your " + "Make sure the Qwen demo server is running and reachable, and that your " "installed Qwen3-TTS version matches this converter's API expectations " "(voice clone requires the Base-model demo: Qwen/Qwen3-TTS-12Hz-1.7B-Base)." ) from exc @@ -635,7 +635,7 @@ class FasterTTSClient(_BaseTTSClient): repository (examples/openai_server.py). The reference voice (ref audio, ref text) and language are configured on the server itself via --ref-audio/--ref-text or a --voices JSON file; this client only sends - text. Unlike the Gradio demo, the server performs one generation per + text. Unlike the Qwen demo, the server performs one generation per request, so long chunks are sub-chunked client-side. """ @@ -779,7 +779,7 @@ class AudioCppTTSClient(_BaseTTSClient): printed by the CLI. Each response is a complete WAV file, so sub-request audio is - concatenated with the same lossless path used for the Gradio client. + concatenated with the same lossless path used for the Qwen client. """ def __init__(self, voice: Optional[str] = None, language: Optional[str] = None, @@ -796,7 +796,7 @@ class AudioCppTTSClient(_BaseTTSClient): self.language = normalize_language( language if language is not None else config.LANGUAGE) # One seed value per run, reused for every request (see - # _resolve_request_seed). Unlike the Gradio demo, audio.cpp has no + # _resolve_request_seed). Unlike the Qwen demo, audio.cpp has no # negative "randomize" seed, so a negative value means "send no seed # at all" (see _request_wav) and the server randomizes. self._seed = _resolve_request_seed() |
