Skip to content

Commit

Permalink
support specifying speed for tts Python APIs (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Oct 24, 2023
1 parent 789a8be commit 1249710
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python-api-examples/offline-tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 1249710

Please sign in to comment.