aboutsummaryrefslogtreecommitdiff
path: root/audiobook.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-20 18:06:22 -0400
committerhistoria <historiavg@proton.me>2026-08-20 18:06:22 -0400
commit5ca77f86b70718b4ef1a07299efbd6431268d546 (patch)
treee50a439ea7a92bd628f78240fdbc2d4093df6928 /audiobook.py
parentb873844f7eb681119542661ef588c5b452f88763 (diff)
downloadtts-audiobook-generator-5ca77f86b70718b4ef1a07299efbd6431268d546.tar.gz
fix: do not chunk with audio.cpp backend (double chunking)
Diffstat (limited to 'audiobook.py')
-rwxr-xr-xaudiobook.py20
1 files changed, 20 insertions, 0 deletions
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: