PromptBuilder.AppendBreak Metod

Definition

Infogar en paus (paus) i innehållet i ett PromptBuilder objekt.

Överlagringar

Name Description
AppendBreak()

Lägger till en paus i objektet PromptBuilder .

AppendBreak(PromptBreak)

Lägger till en brytning i PromptBuilder objektet och anger dess styrka (varaktighet).

AppendBreak(TimeSpan)

Lägger till en paus av den angivna varaktigheten i PromptBuilder objektet.

AppendBreak()

Källa:
PromptBuilder.cs
Källa:
PromptBuilder.cs
Källa:
PromptBuilder.cs
Källa:
PromptBuilder.cs

Lägger till en paus i objektet PromptBuilder .

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

Exempel

I följande exempel skapas en uppmaning som innehåller två meningar avgränsade med en paus och talar om uppmaningen till standardljudenheten på datorn.

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

Kommentarer

Den här metoden anger ingen varaktighet för pausen. Kommer SpeechSynthesizer att fastställa ett varaktighetsvärde baserat på språkkontexten.

Gäller för

AppendBreak(PromptBreak)

Källa:
PromptBuilder.cs
Källa:
PromptBuilder.cs
Källa:
PromptBuilder.cs
Källa:
PromptBuilder.cs

Lägger till en brytning i PromptBuilder objektet och anger dess styrka (varaktighet).

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)

Parametrar

strength
PromptBreak

Anger varaktigheten för pausen.

Exempel

I följande exempel skapas en uppmaning som innehåller två meningar avgränsade med en paus och skickar utdata till en WAV-fil för uppspelning.

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

Kommentarer

Värdena i PromptBreak uppräkningen representerar ett intervall med separationsintervall (pauser) mellan ordgränser. Talsyntesmotorn avgör den exakta varaktigheten för intervallet. När en brytpunkt begärs skickas ett av dessa värden till TTS-motorn (text till tal), som innehåller en mappning mellan dessa värden och motsvarande millisekunders brytvärden.

Gäller för

AppendBreak(TimeSpan)

Källa:
PromptBuilder.cs
Källa:
PromptBuilder.cs
Källa:
PromptBuilder.cs
Källa:
PromptBuilder.cs

Lägger till en paus av den angivna varaktigheten i PromptBuilder objektet.

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

Parametrar

duration
TimeSpan

Tiden i fästingar, där en tick är lika med 100 nanosekunder.

Exempel

I följande exempel skapas en uppmaning som innehåller två meningar avgränsade med en paus på 15 000 000 tick (1,5 sekunder) och talar om uppmaningen till standardljudenheten på datorn.

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

Kommentarer

En brytning kan användas för att styra pauser eller andra prosomasiska gränser mellan ord. En paus är valfri. Om en paus inte finns avgör synteten brytningen mellan ord beroende på språkkontexten.

Gäller för