PromptBuilder.AppendText Método

Definição

Acrescenta texto ao objeto PromptBuilder.

Sobrecargas

AppendText(String)

Especifica o texto a ser acrescentado ao objeto PromptBuilder.

AppendText(String, PromptEmphasis)

Acrescenta texto ao objeto PromptBuilder e especifica o grau de ênfase do texto.

AppendText(String, PromptRate)

Acrescenta texto ao objeto PromptBuilder e especifica o ritmo de fala do texto.

AppendText(String, PromptVolume)

Acrescenta texto ao objeto PromptBuilder e especifica o volume de fala do texto.

AppendText(String)

Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs

Especifica o texto a ser acrescentado ao objeto PromptBuilder.

public:
 void AppendText(System::String ^ textToSpeak);
public void AppendText (string textToSpeak);
member this.AppendText : string -> unit
Public Sub AppendText (textToSpeak As String)

Parâmetros

textToSpeak
String

Uma cadeia de caracteres que contém o texto a ser falado.

Exemplos

O exemplo a seguir cria um PromptBuilder objeto e acrescenta uma cadeia de caracteres de texto usando o AppendText método .

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 append a text string.  
        PromptBuilder speakText = new PromptBuilder();  
        speakText.AppendText("Say the name of the song you want to hear");  

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

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

Comentários

Para acrescentar o texto formatado como linguagem de marcação SSML, use AppendSsmlMarkup.

Aplica-se a

AppendText(String, PromptEmphasis)

Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs

Acrescenta texto ao objeto PromptBuilder e especifica o grau de ênfase do texto.

public:
 void AppendText(System::String ^ textToSpeak, System::Speech::Synthesis::PromptEmphasis emphasis);
public void AppendText (string textToSpeak, System.Speech.Synthesis.PromptEmphasis emphasis);
member this.AppendText : string * System.Speech.Synthesis.PromptEmphasis -> unit
Public Sub AppendText (textToSpeak As String, emphasis As PromptEmphasis)

Parâmetros

textToSpeak
String

Uma cadeia de caracteres que contém o texto a ser falado.

emphasis
PromptEmphasis

O valor para a ênfase ou realce a ser aplicado no texto.

Comentários

Os mecanismos de síntese de fala no Windows não dão suporte ao parâmetro de ênfase no momento. Definir valores para o parâmetro de ênfase não produzirá nenhuma alteração audível na saída de fala sintetizada.

Aplica-se a

AppendText(String, PromptRate)

Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs

Acrescenta texto ao objeto PromptBuilder e especifica o ritmo de fala do texto.

public:
 void AppendText(System::String ^ textToSpeak, System::Speech::Synthesis::PromptRate rate);
public void AppendText (string textToSpeak, System.Speech.Synthesis.PromptRate rate);
member this.AppendText : string * System.Speech.Synthesis.PromptRate -> unit
Public Sub AppendText (textToSpeak As String, rate As PromptRate)

Parâmetros

textToSpeak
String

Uma cadeia de caracteres que contém o texto a ser falado.

rate
PromptRate

O valor do ritmo de fala a ser aplicado ao texto.

Exemplos

O exemplo a seguir cria um PromptBuilder objeto e acrescenta cadeias de caracteres de texto. O exemplo usa o AppendText método para especificar uma taxa de fala lenta para a cadeia de caracteres que está sendo adicionada, que enumera o conteúdo de uma ordem.

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.  
        PromptBuilder speakRate = new PromptBuilder();  
        speakRate.AppendText("Your order for");  
        speakRate.AppendText("one kitchen sink and one faucet", PromptRate.Slow);  
        speakRate.AppendText("has been confirmed.");  

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

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

Aplica-se a

AppendText(String, PromptVolume)

Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs

Acrescenta texto ao objeto PromptBuilder e especifica o volume de fala do texto.

public:
 void AppendText(System::String ^ textToSpeak, System::Speech::Synthesis::PromptVolume volume);
public void AppendText (string textToSpeak, System.Speech.Synthesis.PromptVolume volume);
member this.AppendText : string * System.Speech.Synthesis.PromptVolume -> unit
Public Sub AppendText (textToSpeak As String, volume As PromptVolume)

Parâmetros

textToSpeak
String

Uma cadeia de caracteres que contém o texto a ser falado.

volume
PromptVolume

O valor do volume de fala (altura) a ser aplicado ao texto.

Exemplos

O exemplo a seguir usa o AppendText método para especificar as configurações de volume que o SpeechSynthesizer deve aplicar à saída de fala.

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();  

        // Build a prompt that applies different volume settings.  
        PromptBuilder builder = new PromptBuilder();  
        builder.AppendText("This is the default speaking volume.", PromptVolume.Default);  
        builder.AppendBreak();  
        builder.AppendText("This is the extra loud speaking volume.", PromptVolume.ExtraLoud);  
        builder.AppendBreak();  
        builder.AppendText("This is the medium speaking volume.", PromptVolume.Medium);  

        // Speak the prompt.  
        synth.Speak(builder);  
      }  

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

Comentários

A Default configuração para PromptVolume é volume completo, que é o mesmo ExtraLoudque . As outras configurações diminuem o volume de saída de fala em relação ao volume completo.

Aplica-se a