aboutsummaryrefslogtreecommitdiff
path: root/audiobook.py
diff options
context:
space:
mode:
Diffstat (limited to 'audiobook.py')
-rwxr-xr-xaudiobook.py33
1 files changed, 22 insertions, 11 deletions
diff --git a/audiobook.py b/audiobook.py
index f95e1d3..97171ac 100755
--- a/audiobook.py
+++ b/audiobook.py
@@ -42,6 +42,7 @@ from converter.clients import (
BACKEND_QWEN,
VOICE_MODE_CLONE,
VOICE_MODE_CUSTOM,
+ VOICE_MODE_DESIGN,
normalize_language,
)
from converter.converter import (
@@ -95,7 +96,12 @@ def convert(backend: str = None, voice: str = None, clone: str = None,
elif backend == BACKEND_AUDIOCPP:
voice_mode = VOICE_MODE_CLONE if voice else VOICE_MODE_CUSTOM
else:
- voice_mode = VOICE_MODE_CLONE if clone else VOICE_MODE_CUSTOM
+ # qwen: instructions design the voice (VoiceDesign model), a
+ # reference .wav clones one (Base), otherwise a built-in speaker.
+ if (instructions or "").strip():
+ voice_mode = VOICE_MODE_DESIGN
+ else:
+ voice_mode = VOICE_MODE_CLONE if clone else VOICE_MODE_CUSTOM
if book_files is None or planned is None:
book_files, planned = AudiobookConverter.preflight_overwrites(
@@ -181,6 +187,10 @@ Examples:
# Use the qwen-tts demo server with voice cloning from reference audio
python audiobook.py --backend qwen --clone path/to/reference.wav
+ # Use the qwen-tts demo server with a designed voice (VoiceDesign model)
+ python audiobook.py --backend qwen \\
+ --instructions "A warm adult female narrator with a British accent"
+
# Use the faster-qwen3-tts server (voice cloning, configured server-side)
python audiobook.py --backend faster [--voice NAME]
"""
@@ -276,13 +286,13 @@ Examples:
parser.add_argument(
"--instructions", type=str, default=None, metavar="TEXT",
help=("Voice design or style instruction sent with every request "
- "(--backend audiocpp only). Required for voice design models "
- "(server entries with task 'vdes', e.g. Qwen3-TTS "
- "VoiceDesign): describe the voice to synthesize with, e.g. "
- "'A warm adult female narrator with a British accent'. On "
- "other families it acts as a style/delivery instruction when "
- "the model supports one and is ignored otherwise. Defaults to "
- "AUDIOCPP_INSTRUCTIONS in app/converter/config.py (empty).")
+ "(--backend audiocpp or qwen). With audiocpp it is required "
+ "for voice design models (server entries with task 'vdes', "
+ "e.g. Qwen3-TTS VoiceDesign) and optional style/delivery "
+ "control elsewhere; with qwen it selects the VoiceDesign "
+ "model and describes the voice to synthesize with, e.g. "
+ "'A warm adult female narrator with a British accent' "
+ "(defaulting to INSTRUCT in app/converter/config.py).")
)
parser.add_argument(
"--option", action="append", type=str, default=None, metavar="KEY=VALUE",
@@ -362,9 +372,10 @@ Examples:
parser.error("--model requires --backend audiocpp; it selects an "
"audio.cpp server model entry id")
- if args.instructions is not None and args.backend != BACKEND_AUDIOCPP:
- parser.error("--instructions requires --backend audiocpp; it is "
- "sent as the audio.cpp request's instructions field")
+ if args.instructions is not None and args.backend not in \
+ (BACKEND_AUDIOCPP, BACKEND_QWEN):
+ parser.error("--instructions requires --backend audiocpp or qwen; "
+ "it is sent as the request's voice design/style field")
request_options = {}
if args.option: