aboutsummaryrefslogtreecommitdiff
path: root/audiobook.py
diff options
context:
space:
mode:
Diffstat (limited to 'audiobook.py')
-rwxr-xr-xaudiobook.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/audiobook.py b/audiobook.py
index d3a5426..6ad056c 100755
--- a/audiobook.py
+++ b/audiobook.py
@@ -48,6 +48,10 @@ Examples:
# Use the audio.cpp audiocpp_server with a server-side voice preset
python audiobook.py --backend audiocpp --voice narrator
+ # Use the audio.cpp audiocpp_server with a voice design model (task 'vdes')
+ python audiobook.py --backend audiocpp --model qwen-design \\
+ --instructions "A warm adult female narrator with a British accent"
+
# Use the Qwen demo server with a custom voice
python audiobook.py --backend qwen
@@ -176,6 +180,35 @@ Examples:
"auto-select when the server hosts exactly one entry.")
)
+ 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 converter/config.py (empty).")
+ )
+
+ parser.add_argument(
+ "--option",
+ action="append",
+ type=str,
+ default=None,
+ metavar="KEY=VALUE",
+ help=("Request option passed through to the audio.cpp model "
+ "(--backend audiocpp only); repeatable. Whatever the hosted "
+ "family supports (emotion, voice_id, speed, speaking_rate, "
+ "temperature, ...) — unsupported keys are ignored by the "
+ "model. See the audio.cpp docs for the model's valid option "
+ "keys, e.g. --option emotion=neutral --option speed=1.1.")
+ )
+
args = parser.parse_args()
if args.speed <= 0:
@@ -242,6 +275,21 @@ 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")
+
+ request_options = {}
+ if args.option:
+ if args.backend != BACKEND_AUDIOCPP:
+ parser.error("--option requires --backend audiocpp; the options "
+ "are passed through to the audio.cpp model")
+ for item in args.option:
+ key, sep, value = item.partition("=")
+ if not sep or not key.strip():
+ parser.error(f"--option expects KEY=VALUE (got {item!r})")
+ request_options[key.strip()] = value
+
setup_logging(debug=args.debug)
setup_directories()
@@ -261,6 +309,7 @@ Examples:
voice_mode=voice_mode,
voice_clone_ref_audio=args.clone,
output_format=args.format,
+ instructions=args.instructions,
)
if not book_files:
@@ -287,6 +336,8 @@ Examples:
debug=args.debug,
chunk=args.chunk,
model_id=args.model,
+ instructions=args.instructions,
+ request_options=request_options,
)
converter._book_files = book_files
converter._planned = planned