PromptBuilder.AppendText Método

Definição

Acrescenta texto ao PromptBuilder objeto.

Sobrecargas

Nome Description
AppendText(String)

Especifica o texto a ser acrescentado ao PromptBuilder objeto.

AppendText(String, PromptEmphasis)

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

AppendText(String, PromptRate)

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

AppendText(String, PromptVolume)

Acrescenta o 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 o texto a ser acrescentado 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 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 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 o PromptBuilder texto ao objeto e especifica o grau de ênfase para o 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 da ênfase ou estresse a ser aplicado ao 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
Origem:
PromptBuilder.cs

Acrescenta o 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 de caracteres que contém o texto a ser falado.

rate
PromptRate

O valor da taxa de fala a ser aplicada 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
Origem:
PromptBuilder.cs

Acrescenta o 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 de caracteres que contém o texto a ser falado.

volume
PromptVolume

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

Exemplos

O exemplo a seguir usa o AppendText método para especificar as configurações de volume que devem SpeechSynthesizer ser aplicadas à 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 é PromptVolume de 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