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.

C#
public void 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.

C#
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

.NET 10 (package-provided) i inne wersje
Produkt Wersje
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

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).

C#
public void AppendBreak(System.Speech.Synthesis.PromptBreak strength);

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.

C#
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

.NET 10 (package-provided) i inne wersje
Produkt Wersje
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

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.

C#
public void AppendBreak(TimeSpan duration);

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.

C#
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

.NET 10 (package-provided) i inne wersje
Produkt Wersje
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)