PromptBuilder.AppendBreak Metodo

Definizione

Inserisce un'interruzione (pausa) nel contenuto di un PromptBuilder oggetto .

Overload

Nome Descrizione
AppendBreak()

Aggiunge un'interruzione all'oggetto PromptBuilder .

AppendBreak(PromptBreak)

Aggiunge un'interruzione all'oggetto PromptBuilder e ne specifica la forza (durata).

AppendBreak(TimeSpan)

Aggiunge un'interruzione della durata specificata all'oggetto PromptBuilder .

AppendBreak()

Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs

Aggiunge un'interruzione all'oggetto PromptBuilder .

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

Esempio

L'esempio seguente compila un prompt contenente due frasi separate da un'interruzione e comunica la richiesta al dispositivo audio predefinito nel computer.

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

Commenti

Questo metodo non specifica una durata per l'interruzione. Determina SpeechSynthesizer un valore di durata in base al contesto linguistico.

Si applica a

AppendBreak(PromptBreak)

Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs

Aggiunge un'interruzione all'oggetto PromptBuilder e ne specifica la forza (durata).

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)

Parametri

strength
PromptBreak

Indica la durata dell'interruzione.

Esempio

L'esempio seguente compila un prompt contenente due frasi separate da un'interruzione e invia l'output a un file WAV per la riproduzione.

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

Commenti

I valori nell'enumerazione PromptBreak rappresentano un intervallo di intervalli di separazione (pause) tra i limiti delle parole. Il motore di sintesi vocale determina la durata esatta dell'intervallo. Quando viene richiesta un'interruzione, uno di questi valori viene passato al motore di sintesi vocale (TTS), che contiene un mapping tra questi valori e i valori di interruzione di millisecondi corrispondenti.

Si applica a

AppendBreak(TimeSpan)

Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs

Aggiunge un'interruzione della durata specificata all'oggetto PromptBuilder .

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

Parametri

duration
TimeSpan

Tempo in tick, in cui un segno di graduazione è uguale a 100 nanosecondi.

Esempio

Nell'esempio seguente viene compilata una richiesta contenente due frasi separate da un'interruzione di 15.000.000 tick (1,5 secondi) e comunica la richiesta al dispositivo audio predefinito nel computer.

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

Commenti

Un'interruzione può essere usata per controllare le pause o altri limiti prosodici tra le parole. Un'interruzione è facoltativa. Se non è presente un'interruzione, il sintetizzatore determina l'interruzione tra le parole a seconda del contesto linguistico.

Si applica a