Click or drag to resize

VoiceResourcePlayTTS Method (String, String)

Plays the text specified using the Text-To-Speech engine and using the voice selected.

Namespace:  VoiceElements.Client
Assembly:  VoiceElementsClient (in VoiceElementsClient.dll) Version:
public TerminationCode PlayTTS(
	string ttsString,
	string voice


Type: SystemString
The string you would like the TTS engine to speak. For example: "Hello world"
Type: SystemString
The exact string name of the voice you would like to use. For example: "Microsoft Sam"

Return Value

Type: TerminationCode
A Termination Code indicating how the play ended. Typically, you will use this to determine what to do next.
This Method Uses a SpecificVoice

Note that this method will use the exact voice name you specify. To see what voices you have available, you may check in the Windows control panel or look in the Voice Elements server log. Note that you specify in the string exactly the name of the voice as it appears in control panel or the log. If you would like to simply use the default, use the Play TSS with Default Voice Method.

Controlling TTS Playback Behavior

TTS engines allow you to format your string, use different formats for dates, currency, etc and will generall try to dtermine automatically the best way to speak what you pass to them. However, some advanced features are available. For example, this article on formatting for a TTS engine is typical. Test your application and if needed, determine your TTS engine and if it differ from the srticle shown here and your desired behavior, research its specific to tune your TTS output.

The following sample code sets up a Channel Resource, Dials a Call, retrieves a Voice Resource, and then waits for 2 seconds. After that, it plays a text string using the "Microsoft Sam" voice of the TTS engine.
public void DialOutAndPlayTTS()
// To get a channel, you must first get a link to a Telephony Server.  You may need to pass a username password here.
TelephonyServer m_TelephonyServer = new TelephonyServer();

// Get your channel resource from the server
ChannelResource m_ChannelResource = m_TelephonyServer.GetChannel();

// Example 1: Dial an oubound call
string phoneNumber = "2135551212";

// Get the voice resource and store in a variable for local use
VoiceResource m_VoiceResource = m_ChannelResource.VoiceResource;

// Wait 2 seconds

// Play a string using the defaul TTS voice
m_VoiceResource.PlayTTS("Hello, this is your code speaking.  How is you day going?", "Microsoft Sam");

// Take your code from here ...
See Also