From 1249710e1df5c23cb12f4041c6c0e8d81fac63b7 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Tue, 24 Oct 2023 21:38:58 +0800 Subject: [PATCH] support specifying speed for tts Python APIs (#384) --- python-api-examples/offline-tts.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python-api-examples/offline-tts.py b/python-api-examples/offline-tts.py index 630454d71..1b9e0ccee 100755 --- a/python-api-examples/offline-tts.py +++ b/python-api-examples/offline-tts.py @@ -94,6 +94,13 @@ def get_args(): help="Number of threads for neural network computation", ) + parser.add_argument( + "--speed", + type=float, + default=1.0, + help="Speech speed. Larger->faster; smaller->slower", + ) + parser.add_argument( "text", type=str, @@ -122,7 +129,7 @@ def main(): tts = sherpa_onnx.OfflineTts(tts_config) start = time.time() - audio = tts.generate(args.text, sid=args.sid) + audio = tts.generate(args.text, sid=args.sid, speed=args.speed) end = time.time() if len(audio.samples) == 0: