Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

PromptBuilder.AppendTextWithPronunciation Method

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

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

Syntax

'Declaration
Public Sub AppendTextWithPronunciation ( _
    textToSpeak As String, _
    pronunciation As String _
)
'Usage
Dim instance As PromptBuilder
Dim textToSpeak As String
Dim pronunciation As String

instance.AppendTextWithPronunciation(textToSpeak, _
    pronunciation)
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).

Remarks

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(String). For more information see Lexicons and Phonetic Alphabets (Microsoft.Speech).

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 ə.

The IPA publishes a chart that maps its phoneme set to Unicode numbers.

Examples

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>

See Also

Reference

PromptBuilder Class

PromptBuilder Members

Microsoft.Speech.Synthesis Namespace

Other Resources

International Phonetic Association

Lexicons and Phonetic Alphabets (Microsoft.Speech)