From 5ca77f86b70718b4ef1a07299efbd6431268d546 Mon Sep 17 00:00:00 2001 From: historia Date: Thu, 20 Aug 2026 18:06:22 -0400 Subject: fix: do not chunk with audio.cpp backend (double chunking) --- audiobook.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'audiobook.py') diff --git a/audiobook.py b/audiobook.py index c2639ce..b881a12 100755 --- a/audiobook.py +++ b/audiobook.py @@ -145,11 +145,30 @@ Examples: "and log every TTS request and response to the console and log file.") ) + parser.add_argument( + "--chunk", + action="store_true", + help=("Force client-side chunking into CHUNK_SIZE-word requests (see " + "converter/config.py). Only matters for --backend audiocpp, which " + "otherwise sends each chapter as one request and lets the server " + "chunk long text itself; the gradio and faster backends always " + "chunk.") + ) + args = parser.parse_args() if args.speed <= 0: parser.error(f"--speed must be a positive number (got {args.speed:g})") + if args.chunk: + if args.backend == BACKEND_AUDIOCPP: + print("[WARNING] --chunk: the audio.cpp server already splits long text " + "internally (its text_chunk_size); forcing client-side chunking " + "may cause needless double-chunking") + else: + print(f"[INFO] --chunk has no effect with --backend {args.backend}: " + "that backend always chunks") + if args.backend == BACKEND_FASTER: if args.clone: print("[WARNING] --clone is ignored with --backend faster: that backend " @@ -221,6 +240,7 @@ Examples: backend=args.backend, voice=args.voice, debug=args.debug, + chunk=args.chunk, ) ok = converter.run() except KeyboardInterrupt: -- cgit v1.2.3