Click or drag to resize

TelephonyServerTtsToFile Method (String, String, String)

Converts the specified text string into speech and saves it as the designated file using the voice designated in the third parameter.

Namespace:  VoiceElements.Client
Assembly:  VoiceElementsClient (in VoiceElementsClient.dll) Version: 8.6.1.1
Syntax
public void TtsToFile(
	string ttsText,
	string outputFile,
	string voice
)

Parameters

ttsText
Type: SystemString
String

Description: This is the text that the TTS engine will speak into the output file.

Note: You can use parameters and tags to change the way the engine speaks and also specify currency, dates, etc. For more information on configuring TTS by adding paramters to this string, see Text-to-Speech Tips and Topics from Inventive Labs support.

outputFile
Type: SystemString
String of Path and File Name

This specifies the file for the wave output. See remarks below about file format.

voice
Type: SystemString
String

Description: This is the voice to be used in speaking the string into the file. Many vendors provide a whole range of voices to use, including male, female and different accents. The voices available to you are installed on the Voice Elements server. There are some low quality voices included in different versions of Windows for testing, but for production you may need to install one you prefer. For help finding out what voices you have, see How do I find what voices are available? from Inventive Labs support.

Exceptions
ExceptionCondition
ElementsException Thrown when the file or text string are null or a file access exception occurs.
Remarks
Output File Format

The output file will usually be formatted as 8 kHz 8 bit mu-law wave file. Voice Elements uses native G.711 which determines the format. This is the codec used at the transport level for SIP, T1's and PRI's. This allows files to be played without any conversion overhead.


For more information on TTS settings on the server, see TTS Settings on Voice Elements Server from Inventive Labs support.

Examples
This sample uses a passed Telphony Server object to record "Hello World from Mr TTS Sam" to a file using 'Microsoft Sam', a default Windows voice.
C#
class TestClass
{
    public void TestMethod(TelephonyServer telephonyServer)
    {
        // Record the string "Hello world from Mr TTS Sam" to file "HelloWorld.wav"
        telephonyServer.TtsToFile("Hello world from Mr TTS Sam", "C:\\Temp\\HelloWorld.wav", "Microsoft Sam");
        return;
    }
}
See Also