aboutsummaryrefslogtreecommitdiff
path: root/audiobook.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-18 23:27:42 -0400
committerhistoria <historiavg@proton.me>2026-08-18 23:27:42 -0400
commitf3e21980320c1708ff17cc6f699a9aa4758accdf (patch)
tree596ff71ba68600bb24a5a9d88424951c77e02808 /audiobook.py
parenta97c0506f8b20cdc5ed8a11892ef10a9fc1938ef (diff)
downloadtts-audiobook-generator-f3e21980320c1708ff17cc6f699a9aa4758accdf.tar.gz
feat: support for faster-qwen3-tts backend server
Diffstat (limited to 'audiobook.py')
-rwxr-xr-xaudiobook.py63
1 files changed, 53 insertions, 10 deletions
diff --git a/audiobook.py b/audiobook.py
index 34806f2..ed92e53 100755
--- a/audiobook.py
+++ b/audiobook.py
@@ -37,6 +37,9 @@ Examples:
# Use voice cloning with reference audio
python audiobook.py --clone path/to/reference.wav
+
+ # Use the faster-qwen3-tts server (voice cloning, configured server-side)
+ python audiobook.py --faster
"""
)
@@ -96,27 +99,65 @@ Examples:
"Ignored for m4b, which is always a single file.")
)
+ parser.add_argument(
+ "--faster",
+ action="store_true",
+ help=("Use a faster-qwen3-tts OpenAI-compatible server instead of the Qwen "
+ "Gradio demos (5-10x faster inference via CUDA graphs). Always voice "
+ "cloning: the reference audio and transcript are configured on the "
+ "server itself (see the 'Faster backend' section of the README).")
+ )
+
+ parser.add_argument(
+ "--faster-voice",
+ type=str,
+ default=None,
+ metavar="NAME",
+ help=("Voice entry to request from the faster server's voice config "
+ "(default: the FASTER_TTS_VOICE setting in converter/config.py, "
+ "typically 'default'). Must match a key in the server's voices.json, "
+ "or 'default' when the server was started with --ref-audio.")
+ )
+
args = parser.parse_args()
if args.speed <= 0:
parser.error(f"--speed must be a positive number (got {args.speed:g})")
- if args.language is not None:
- try:
- args.language = normalize_language(args.language)
- except ValueError as exc:
- parser.error(str(exc))
-
- if not args.clone and (args.transcription or args.no_transcription):
- print("[WARNING] --transcription/--no-transcription "
- "are ignored without --clone")
+ if args.faster:
+ if args.clone:
+ print("[WARNING] --clone is ignored with --faster: the faster backend "
+ "always uses voice cloning, and the reference voice is configured "
+ "on the faster server (see README)")
+ args.clone = None
+ if args.transcription or args.no_transcription:
+ print("[WARNING] --transcription/--no-transcription are ignored with "
+ "--faster: the reference transcript is configured on the faster "
+ "server (--ref-text or voices.json, see README)")
+ args.transcription = None
+ args.no_transcription = False
+ if args.language is not None:
+ print("[WARNING] --language is ignored with --faster: language is "
+ "configured on the faster server (see README)")
+ args.language = None
+ else:
+ if args.language is not None:
+ try:
+ args.language = normalize_language(args.language)
+ except ValueError as exc:
+ parser.error(str(exc))
+
+ if not args.clone and (args.transcription or args.no_transcription):
+ print("[WARNING] --transcription/--no-transcription "
+ "are ignored without --clone")
setup_logging()
setup_directories()
try:
converter = AudiobookConverter(
- voice_mode=config.VOICE_MODE_CLONE if args.clone else config.VOICE_MODE_CUSTOM,
+ voice_mode=config.VOICE_MODE_CLONE if (args.clone or args.faster)
+ else config.VOICE_MODE_CUSTOM,
voice_clone_ref_audio=args.clone,
voice_clone_ref_text=args.transcription,
skip_transcription=args.no_transcription,
@@ -124,6 +165,8 @@ Examples:
single_file=args.single_file,
output_format=args.format,
language=args.language,
+ faster=args.faster,
+ faster_voice=args.faster_voice,
)
ok = converter.run()
except KeyboardInterrupt: