PromptBuilder.AppendBreak Metoda

Definicja

Wstawia podział (wstrzymywanie) w zawartości PromptBuilder obiektu.

Przeciążenia

AppendBreak()

Dołącza podział do PromptBuilder obiektu.

AppendBreak(PromptBreak)

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

AppendBreak(TimeSpan)

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

AppendBreak()

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 wiersz zawierający dwa zdania oddzielone podziałem 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. Wartość SpeechSynthesizer określi wartość czasu trwania na podstawie kontekstu językowego.

Dotyczy

AppendBreak(PromptBreak)

Dołącza podział do obiektu PromptBuilder 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 wiersz zawierający dwa zdania oddzielone podziałem i wysyła dane wyjściowe do pliku WAV w celu 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 PromptBreak wyliczeniu reprezentują zakres interwałów odseparowania (wstrzymywania) między granicami wyrazów. Aparat syntezy mowy określa dokładny czas trwania interwału. Gdy żądanie przerwania jest żądane, jedna z tych wartości jest przekazywana do aparatu funkcji text-to-speech (TTS), który zawiera mapowanie między tymi wartościami i odpowiednimi wartościami podziału (milisekund).

Dotyczy

AppendBreak(TimeSpan)

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 taktach, gdzie jeden takt to 100 nanosekund.

Przykłady

Poniższy przykład tworzy wiersz zawierający dwa zdania oddzielone podziałem 15 000 000 takt (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 pauzy lub innych granic prosodycznych między wyrazami. Przerwa jest opcjonalna. Jeśli nie ma przerwy, syntetyzator określa przerwę między wyrazami w zależności od kontekstu językowego.

Dotyczy