Compartilhar via


PromptBuilder.AppendBreak Método

Definição

Insere uma quebra (pausa) no conteúdo de um objeto PromptBuilder.

Sobrecargas

AppendBreak()

Acrescenta uma interrupção ao objeto PromptBuilder.

AppendBreak(PromptBreak)

Acrescenta uma interrupção ao objeto PromptBuilder e especifica sua intensidade (duração).

AppendBreak(TimeSpan)

Acrescenta uma interrupção da duração especificada ao objeto PromptBuilder.

AppendBreak()

Acrescenta uma interrupção ao objeto PromptBuilder.

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

Exemplos

O exemplo a seguir cria um prompt que contém duas frases separadas por uma quebra e fala o prompt para o dispositivo de áudio padrão no computador.

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 with two sentences separated by a break.  
        PromptBuilder builder = new PromptBuilder(  
          new System.Globalization.CultureInfo("en-US"));  
        builder.AppendText(  
          "Tonight's movie showings in theater A are at 5:45, 7:15, and 8:45.");  
        builder.AppendBreak();  
        builder.AppendText(  
          "Tonight's movie showings in theater B are at 5:15, 7:30, and 9:15.");  

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

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

Comentários

Esse método não especifica uma duração para a quebra. O SpeechSynthesizer determinará um valor de duração com base no contexto linguístico.

Aplica-se a

AppendBreak(PromptBreak)

Acrescenta uma interrupção ao objeto PromptBuilder e especifica sua intensidade (duração).

public:
 void AppendBreak(System::Speech::Synthesis::PromptBreak strength);
public void AppendBreak (System.Speech.Synthesis.PromptBreak strength);
member this.AppendBreak : System.Speech.Synthesis.PromptBreak -> unit
Public Sub AppendBreak (strength As PromptBreak)

Parâmetros

strength
PromptBreak

Indica a duração da quebra.

Exemplos

O exemplo a seguir cria um prompt que contém duas frases separadas por uma quebra e envia a saída para um arquivo WAV para reprodução.

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.SetOutputToWaveFile(@"C:\test\weather.wav");  

        // Create a SoundPlayer instance to play the output audio file.  
        System.Media.SoundPlayer m_SoundPlayer =  
          new System.Media.SoundPlayer(@"C:\test\weather.wav");  

        // Build a prompt with two sentences separated by a break.  
        PromptBuilder builder = new PromptBuilder(  
          new System.Globalization.CultureInfo("en-US"));  
        builder.AppendText(  
          "Tonight's movie showings in theater A are at 5:45, 7:15, and 8:45");  
        builder.AppendBreak(PromptBreak.Medium);  
        builder.AppendText(  
          "Tonight's movie showings in theater B are at 5:15, 7:15, and 9:15");  

        // Speak the prompt and play back the output file.  
        synth.Speak(builder);  
        m_SoundPlayer.Play();  
      }  

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

Comentários

Os valores na PromptBreak enumeração representam um intervalo de intervalos de separação (pausas) entre limites de palavra. O mecanismo de síntese de fala determina a duração exata do intervalo. Quando uma quebra é solicitada, um desses valores é passado para o mecanismo de TTS (texto em fala), que contém um mapeamento entre esses valores e os valores de quebra de milissegundos correspondentes.

Aplica-se a

AppendBreak(TimeSpan)

Acrescenta uma interrupção da duração especificada ao objeto PromptBuilder.

public:
 void AppendBreak(TimeSpan duration);
public void AppendBreak (TimeSpan duration);
member this.AppendBreak : TimeSpan -> unit
Public Sub AppendBreak (duration As TimeSpan)

Parâmetros

duration
TimeSpan

A hora, em tiques, em que um tique é igual a 100 nanossegundos.

Exemplos

O exemplo a seguir cria um prompt que contém duas frases separadas por uma quebra de 15.000.000 tiques (1,5 segundos) e fala o prompt para o dispositivo de áudio padrão no computador.

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 with two sentences separated by a break.  
        PromptBuilder builder = new PromptBuilder(  
          new System.Globalization.CultureInfo("en-US"));  
        builder.AppendText(  
          "Tonight's movie showings in theater A are at 5:45, 7:15, and 8:45");  
        builder.AppendBreak(new TimeSpan(15000000));  
        builder.AppendText(  
          "Tonight's movie showings in theater B are at 5:15, 7:15, and 9:15");  

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

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

Comentários

Uma quebra pode ser usada para controlar pausas ou outros limites prosódicos entre palavras. Uma quebra é opcional. Se uma quebra não estiver presente, o sintetizador determinará a quebra entre palavras dependendo do contexto linguístico.

Aplica-se a