diff options
| author | historia <historiavg@proton.me> | 2026-08-26 21:22:40 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-26 21:22:40 -0400 |
| commit | 477ac3e827e3bdc9f14583fc3aa8db1fa2d27c52 (patch) | |
| tree | 1e21fa5af1d7a95ffc62fb03eed153056c38ae9e /audiobook.py | |
| parent | 65c6f737f1545ef225768af897acd20f163a4fb4 (diff) | |
| download | tts-audiobook-generator-477ac3e827e3bdc9f14583fc3aa8db1fa2d27c52.tar.gz | |
feat: design model support for qwen-tts backend. remove unnecessary port split for qwen models
Diffstat (limited to 'audiobook.py')
| -rwxr-xr-x | audiobook.py | 33 |
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: |
