PromptBuilder.AppendText Método

Definição

Acrescenta texto ao PromptBuilder objeto.

Sobrecargas

Name Description
AppendText(String)

Especifica texto a anexar ao PromptBuilder objeto.

AppendText(String, PromptEmphasis)

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

AppendText(String, PromptRate)

Acrescenta texto ao PromptBuilder objeto e especifica a taxa de fala do texto.

AppendText(String, PromptVolume)

Acrescenta texto ao PromptBuilder objeto e especifica o volume para falar o texto.

AppendText(String)

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

Especifica texto a anexar ao PromptBuilder objeto.

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 contendo o texto a ser dito.

Exemplos

O exemplo que se segue cria um PromptBuilder objeto e acrescenta uma cadeia 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();
    }
  }
}

Observações

Para adicionar 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
Origem:
PromptBuilder.cs

Acrescenta texto ao PromptBuilder objeto 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 contendo o texto a ser dito.

emphasis
PromptEmphasis

O valor da ênfase ou da ênfase para aplicar ao texto.

Observações

Os motores de síntese de voz no Windows não suportam o parâmetro de ênfase neste momento. Definir valores para o parâmetro de ênfase não produzirá qualquer alteração audível na saída da fala sintetizada.

Aplica-se a

AppendText(String, PromptRate)

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

Acrescenta texto ao PromptBuilder objeto e especifica a taxa 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 contendo o texto a ser dito.

rate
PromptRate

O valor da taxa de fala aplica-se ao texto.

Exemplos

O exemplo seguinte cria um PromptBuilder objeto e acrescenta cadeias de texto. O exemplo utiliza o AppendText método para especificar uma taxa de fala lenta para a cadeia a ser 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
Origem:
PromptBuilder.cs

Acrescenta texto ao PromptBuilder objeto e especifica o volume para falar o 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 contendo o texto a ser dito.

volume
PromptVolume

O valor do volume de fala (volume) aplica-se ao texto.

Exemplos

O exemplo seguinte utiliza o AppendText método para especificar as definições de volume que SpeechSynthesizer devem ser aplicadas à saída de voz.

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

Observações

A Default definição para PromptVolume é volume máximo, que é a mesma que ExtraLoud. As outras definições diminuem o volume de saída da fala em relação ao volume máximo.

Aplica-se a