Κοινή χρήση μέσω


PromptBuilder.StartParagraph Method

Definition

Specifies the start of a paragraph in the PromptBuilder object, and optionally specifies a language.

Overloads

StartParagraph(CultureInfo)

Specifies the start of a paragraph in the specified culture in the PromptBuilder object.

StartParagraph()

Specifies the start of a paragraph in the PromptBuilder object.

Remarks

Long prompts can be rendered more like human speech if they are broken into sentences and paragraphs.

StartParagraph(CultureInfo)

Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs

Specifies the start of a paragraph in the specified culture in the PromptBuilder object.

public:
 void StartParagraph(System::Globalization::CultureInfo ^ culture);
public void StartParagraph (System.Globalization.CultureInfo culture);
member this.StartParagraph : System.Globalization.CultureInfo -> unit
Public Sub StartParagraph (culture As CultureInfo)

Parameters

culture
CultureInfo

Provides information about a specific culture, such as the language, the name of the culture, the writing system, the calendar used, and how to format dates and sort strings.

Remarks

Long prompts can be rendered more like human speech if they are broken into sentences and paragraphs.

The culture parameter for a paragraph can be different than the Culture property of the PromptBuilder object that contains it. While in effect, the value of the culture parameter will override the Culture property. The SpeechSynthesizer will attempt to select an installed voice that supports the language specified by the culture parameter to speak the paragraph. If a voice with the specified culture is found, it will be used. If a voice with the specified culture cannot be found, the default voice will be used. To stop using the voice specified by StartParagraph, call EndParagraph.

To correctly pronounce words in the language specified by the culture parameter, a speech synthesis (text-to-speech or TTS) engine that supports the language must be installed. An installed TTS engine is called a voice. To get information about which voices are installed for a specific culture, use the GetInstalledVoices method.

Microsoft Windows and the System.Speech API accept all valid language-country codes as values for culture. The TTS engines that shipped with Windows 7 support the following language-country codes:

  • en-US. English (United States)

  • zh-CN. Chinese (China)

  • zh-TW. Chinese (Taiwan)

Two-letter language codes such as "en" are also permitted.

Applies to

StartParagraph()

Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs

Specifies the start of a paragraph in the PromptBuilder object.

public:
 void StartParagraph();
public void StartParagraph ();
member this.StartParagraph : unit -> unit
Public Sub StartParagraph ()

Examples

The following example creates a PromptBuilder object, appends content, and organizes the content into paragraphs and sentences.

using System;  
using System.Speech.Synthesis;  

namespace SampleSynthesis  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  

      // Initialize a new instance of the SpeechSynthesizer.  
      using (SpeechSynthesizer synth = new SpeechSynthesizer())  
      {  

        // Configure the audio output.   
        synth.SetOutputToDefaultAudioDevice();  

        // Create a PromptBuilder object and add content as paragraphs and sentences.  
        PromptBuilder parSent = new PromptBuilder();  
        parSent.StartParagraph();  
        parSent.StartSentence();  
        parSent.AppendText("Introducing the sentence element.");  
        parSent.EndSentence();  
        parSent.StartSentence();  
        parSent.AppendText("You can use it to mark individual sentences.");  
        parSent.EndSentence();  
        parSent.EndParagraph();  
        parSent.StartParagraph();  
        parSent.AppendText("Another simple paragraph. Sentence structure in this paragraph" +  
          "is not explicitly marked.");  
        parSent.EndParagraph();  

        // Speak the contents of the SSML prompt.  
        synth.Speak(parSent);  
      }  

      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  
  }  
}  

Remarks

Long prompts can be rendered more like human speech if they are broken into sentences and paragraphs.

Applies to