How to adjust the pace (speed)

The pace parameter controls the speed at which the speech is delivered.

It is optional — if omitted, the default value is 1.0 (normal speed).

  • Valid range: 0.3 (slowest) to 3.0 (fastest)
  • Values < 1.0 slow the speech down; values > 1.0 speed it up.
  • Adjust this to speed up or slow down the voice according to your needs.

Example Code

1from sarvamai import SarvamAI
2from sarvamai.play import save
3
4# Initialize the REST client
5client = SarvamAI(api_subscription_key="YOUR_API_SUBSCRIPTION_KEY")
6
7# Generate speech using REST
8audio = client.text_to_speech.convert(
9 text="Welcome to Sarvam AI!",
10 model="bulbul:v2",
11 target_language_code="en-IN",
12 pace=1.5 # Increase pace for faster speech
13)
14save(audio, "output1.wav")