Share via


PromptBuilder.AppendBreak Méthode

Définition

Insère un saut de ligne (pause) dans le contenu d'un objet PromptBuilder.

Surcharges

AppendBreak()

Ajoute une interruption à l'objet PromptBuilder.

AppendBreak(PromptBreak)

Ajoute une interruption à l'objet PromptBuilder et spécifie sa force (durée).

AppendBreak(TimeSpan)

Ajoute une interruption de la durée spécifiée à l'objet PromptBuilder.

AppendBreak()

Ajoute une interruption à l'objet PromptBuilder.

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

Exemples

L’exemple suivant génère une invite contenant deux phrases séparées par un saut et parle l’invite du périphérique audio par défaut sur l’ordinateur.

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

Remarques

Cette méthode ne spécifie pas de durée pour l’arrêt. SpeechSynthesizerDétermine une valeur de durée basée sur le contexte linguistique.

S’applique à

AppendBreak(PromptBreak)

Ajoute une interruption à l'objet PromptBuilder et spécifie sa force (durée).

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)

Paramètres

strength
PromptBreak

Indique la durée de l’arrêt.

Exemples

L’exemple suivant génère une invite contenant deux phrases séparées par un arrêt et envoie la sortie vers un fichier WAV pour la lecture.

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

Remarques

Les valeurs de l' PromptBreak énumération représentent une plage d’intervalles de séparation (pauses) entre les limites de mots. Le moteur de synthèse vocale détermine la durée exacte de l’intervalle. Lorsqu’une interruption est demandée, l’une de ces valeurs est transmise au moteur de synthèse vocale (TTS), qui contient un mappage entre ces valeurs et les valeurs d’arrêt en millisecondes correspondantes.

S’applique à

AppendBreak(TimeSpan)

Ajoute une interruption de la durée spécifiée à l'objet PromptBuilder.

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

Paramètres

duration
TimeSpan

Temps en graduations, où une graduation est égale à 100 nanosecondes.

Exemples

L’exemple suivant génère une invite contenant deux phrases séparées par une pause de 15 millions cycles (1,5 secondes) et parle l’invite du périphérique audio par défaut sur l’ordinateur.

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

Remarques

Un saut peut être utilisé pour contrôler les pauses ou d’autres limites prosodique entre les mots. Un arrêt est facultatif. Si un arrêt n’est pas présent, le synthétiseur détermine l’interruption entre les mots selon le contexte linguistique.

S’applique à