PromptBuilder.AppendBreak Metoda

Definicja

Wstawia przerwę (wstrzymaj) w zawartości PromptBuilder obiektu.

Przeciążenia

AppendBreak()

Dołącza podział do PromptBuilder obiektu.

AppendBreak(PromptBreak)

Dołącza podział do PromptBuilder obiektu i określa jego siłę (czas trwania).

AppendBreak(TimeSpan)

Dołącza podział określonego czasu trwania do PromptBuilder obiektu.

AppendBreak()

Źródło:
PromptBuilder.cs
Źródło:
PromptBuilder.cs
Źródło:
PromptBuilder.cs

Dołącza podział do PromptBuilder obiektu.

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

Przykłady

Poniższy przykład tworzy monit zawierający dwa zdania oddzielone przerwą i mówi monit do domyślnego urządzenia audio na komputerze.

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

Uwagi

Ta metoda nie określa czasu trwania przerwania. Element SpeechSynthesizer określa wartość czasu trwania na podstawie kontekstu językowego.

Dotyczy

AppendBreak(PromptBreak)

Źródło:
PromptBuilder.cs
Źródło:
PromptBuilder.cs
Źródło:
PromptBuilder.cs

Dołącza podział do PromptBuilder obiektu i określa jego siłę (czas trwania).

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)

Parametry

strength
PromptBreak

Wskazuje czas trwania przerwania.

Przykłady

Poniższy przykład tworzy monit zawierający dwa zdania oddzielone przerwą i wysyła dane wyjściowe do pliku WAV na potrzeby odtwarzania.

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

Uwagi

Wartości w wyliczenie PromptBreak reprezentują zakres interwałów separacji (wstrzymywania) między granicami wyrazów. Aparat syntezy mowy określa dokładny czas trwania interwału. Po żądaniu przerwania jedna z tych wartości jest przekazywana do aparatu zamiany tekstu na mowę (TTS), który zawiera mapowanie między tymi wartościami i odpowiadającymi im wartościami przerwania w milisekundach.

Dotyczy

AppendBreak(TimeSpan)

Źródło:
PromptBuilder.cs
Źródło:
PromptBuilder.cs
Źródło:
PromptBuilder.cs

Dołącza podział określonego czasu trwania do PromptBuilder obiektu.

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

Parametry

duration
TimeSpan

Czas w kleszczach, gdzie jeden kleszcz wynosi 100 nanosekund.

Przykłady

Poniższy przykład tworzy monit zawierający dwa zdania oddzielone podziałem na 15 000 000 znaczników (1,5 sekundy) i mówi monit do domyślnego urządzenia audio na komputerze.

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

Uwagi

Przerwa może służyć do kontrolowania wstrzymywania lub innych prodykycznych granic między wyrazami. Przerwa jest opcjonalna. Jeśli przerwa nie istnieje, syntetyzator określa przerwę między wyrazami w zależności od kontekstu językowego.

Dotyczy