ISynthesizer.Rate Property
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Gets the speaking rate of the Synthesizer.
Namespace: Microsoft.SpeechServer.Synthesis
Assembly: Microsoft.SpeechServer (in microsoft.speechserver.dll)
Syntax
'Declaration
ReadOnly Property Rate As Single
float Rate { get; }
Property Value
The speaking rate of the Synthesizer.
Remarks
The Rate property is read-only. Use the ChangeRate method to change the value of Rate.
Example
using System;
using System.Collections.Generic;
using System.Text;
using System.Workflow.Activities;
using System.Workflow.ComponentModel;
using Microsoft.SpeechServer.Dialog;
using Microsoft.SpeechServer.Synthesis;
namespace YourSpeechApplicationNamespace
{
/// <summary>
/// Activity deriving from SpeechCompositeActivity.
/// </summary>
public class ISynthesizer_Rate : SpeechCompositeActivity
{
/// <summary>
/// Prompt played by the activity.
/// </summary>
const string Prompt1 = "This is a prompt with an increased rate. ";
const string Prompt2 = "This is a prompt with a normal rate. ";
Single value;
/// <summary>
/// Creates a new instance.
/// </summary>
public ISynthesizer_Rate()
{
}
/// <summary>
/// Executes the activity.
/// </summary>
/// <param name="executionContext">The execution context</param>
protected override void ExecuteCore(ActivityExecutionContext executionContext)
{
// Increase rate for the first prompt
value = Workflow.Synthesizer.Rate;
Workflow.Synthesizer.ChangeRate(value + 1);
// Specify event-handler and play first prompt
Workflow.Synthesizer.SpeakCompleted += Synthesizer_SpeakCompleted1;
Workflow.Synthesizer.SpeakAsync(Prompt1, SynthesisTextFormat.PlainText);
}
/// <summary>
/// Plays the second prompt.
/// </summary>
/// <param name="sender">The synthesizer</param>
/// <param name="e">The result of SpeakAsync</param>
private void Synthesizer_SpeakCompleted1(object sender, SpeakCompletedEventArgs e)
{
// Remove this event-handler
Workflow.Synthesizer.SpeakCompleted -= Synthesizer_SpeakCompleted1;
// Restore default rate for the second prompt
Workflow.Synthesizer.ChangeRate(value);
// Specify event-handler and play second prompt
Workflow.Synthesizer.SpeakCompleted += Synthesizer_SpeakCompleted2;
Workflow.Synthesizer.SpeakAsync(Prompt2, SynthesisTextFormat.PlainText);
}
/// <summary>
/// Closes the activity.
/// </summary>
/// <param name="sender">The synthesizer</param>
/// <param name="e">The result of SpeakAsync</param>
private void Synthesizer_SpeakCompleted2(object sender, SpeakCompletedEventArgs e)
{
// Remove this event-handler
Workflow.Synthesizer.SpeakCompleted -= Synthesizer_SpeakCompleted2;
// End the custom activity
Close(e.Error);
}
}
}
Thread Safety
All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.
Platforms
Development Platforms
Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition
Target Platforms
Windows Server 2003
See Also
Reference
ISynthesizer Interface
ISynthesizer Members
Microsoft.SpeechServer.Synthesis Namespace