Note
Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.
SpeechSynthesizer.Rate Property
Gets or sets the speaking rate of the SpeechSynthesizer object.
Namespace: Microsoft.Speech.Synthesis
Assembly: Microsoft.Speech (in Microsoft.Speech.dll)
Syntax
'Declaration
Public Property Rate As Integer
Get
Set
'Usage
Dim instance As SpeechSynthesizer
Dim value As Integer
value = instance.Rate
instance.Rate = value
public int Rate { get; set; }
Property Value
Type: System.Int32
Returns the speaking rate of the SpeechSynthesizer object, from -10 through 10.
Examples
The following example speaks a string with the speaking rate set to -2.
using System;
using Microsoft.Speech.Synthesis;
namespace SampleSynthesis
{
class Program
{
static void Main(string[] args)
{
// Initialize a new instance of the SpeechSynthesizer.
SpeechSynthesizer synth = new SpeechSynthesizer();
// Set the speaking rate.
synth.Rate = -2;
// Configure the audio output.
synth.SetOutputToWaveFile(@"C:\test\Rate.wav");
// Create a SoundPlayer instance to play the output audio file.
System.Media.SoundPlayer m_SoundPlayer =
new System.Media.SoundPlayer(@"C:\test\Rate.wav");
// Speak a text string synchronously and play back the output file.
synth.Speak("This example speaks a string with the speaking rate set to -2.");
m_SoundPlayer.Play();
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}