Export (0) Print
Expand All

PromptBuilder.AppendTextWithPronunciation Method

Appends text to the PromptBuilder object and specifies the pronunciation for the text.

Namespace:  System.Speech.Synthesis
Assembly:  System.Speech (in System.Speech.dll)

public void AppendTextWithPronunciation(
	string textToSpeak,
	string pronunciation
)

Parameters

textToSpeak
Type: System.String

A string containing the written form of the word using the conventional alphabet for a language.

pronunciation
Type: System.String

A string containing phones to be spoken from the International Phonetic Alphabet (IPA).

The synthesizer speaks the contents of the pronunciation parameter, not the contents of the textToSpeak parameter.

Pronunciations specified inline in prompts apply only to the individual occurrence of a word and override pronunciations of the speech engine or any of its currently active lexicons. Typically, you will use inline pronunciations for custom pronunciations of existing words or for pronunciation of uncommon words, such as proper names, which the speech synthesis engine may not pronounce as well as expected.

Inline pronunciations must be specified using phones from the International Phonetic Alphabet (IPA). A phone is a letter or character that represents a discreet sound of speech. Speech engines that comply with the Speech Synthesis Markup Language (SSML) Version 1.0 specification will pronounce phones from the IPA. To specify inline pronunciations using other phonetic alphabets, see AppendSsmlMarkup.

The IPA publishes a chart that lists its phones and maps them to Unicode numbers.

Some phones in the IPA alphabet have the same representations as letters in the Latin alphabet. In those cases, it is possible to type the Latin character and have the proper representation for a phone. Because the Latin characters as commonly used in text may represent several phones of the IPA phone set, simply typing the Latin character might not result in the precise IPA phone desired. Other phones of the IPA alphabet need to be represented in code as character references consisting of an ampersand (&), the number sign (#), and a Unicode number for the desired phone in hexadecimal or decimal, all followed by a semicolon (;). For example, a schwa (ə) would be represented by ə.

To add new or custom pronunciations for multiple words, for example to express regional dialects or to add proper names or vocabulary that is specific to an educational or medical discipline, build a lexicon and add it to the SpeechSynthesizer using AddLexicon.

The following example initializes a new instance of the PromptBuilder class. It then appends the text string "My name is" to the instance. Finally, it appends a string containing the proper name "DuBois" and specifies the pronunciation of the name.

public void ProperName()
{
    PromptBuilder builder = new PromptBuilder();
    builder.AppendText("My name is");

    // Add a proper name and its pronunciation.
    builder.AppendTextWithPronunciation("DuBois", "duˈbwɑ");   
}

The following markup shows the SSML that this PromptBuilder object generates.

<speak xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-us">
  My name is <phoneme ph="duˈbwɑ"> DuBois </phoneme>
</speak>

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft