PromptBuilder.AppendBreak Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Insère un saut (pause) dans le contenu d’un PromptBuilder objet.
Surcharges
| Nom | Description |
|---|---|
| AppendBreak() |
Ajoute un saut à l’objet PromptBuilder . |
| AppendBreak(PromptBreak) |
Ajoute un saut à l’objet PromptBuilder et spécifie sa force (durée). |
| AppendBreak(TimeSpan) |
Ajoute un saut de la durée spécifiée à l’objet PromptBuilder . |
AppendBreak()
- Source:
- PromptBuilder.cs
- Source:
- PromptBuilder.cs
- Source:
- PromptBuilder.cs
- Source:
- PromptBuilder.cs
Ajoute un saut à 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 à l’appareil 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. La SpeechSynthesizer valeur de durée est déterminée en fonction du contexte linguistique.
S’applique à
AppendBreak(PromptBreak)
- Source:
- PromptBuilder.cs
- Source:
- PromptBuilder.cs
- Source:
- PromptBuilder.cs
- Source:
- PromptBuilder.cs
Ajoute un saut à 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 saut et envoie la sortie à 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’énumération PromptBreak 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’un saut est demandé, l’une de ces valeurs est passée au moteur de synthèse vocale (TTS), qui contient un mappage entre ces valeurs et les valeurs d’arrêt de millisecondes correspondantes.
S’applique à
AppendBreak(TimeSpan)
- Source:
- PromptBuilder.cs
- Source:
- PromptBuilder.cs
- Source:
- PromptBuilder.cs
- Source:
- PromptBuilder.cs
Ajoute un saut 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 cycles, où une graduation est égale à 100 nanosecondes.
Exemples
L’exemple suivant génère une invite contenant deux phrases séparées par un saut de 15 000 000 cycles (1,5 secondes) et parle l’invite au 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 prosodiques entre les mots. Un saut est facultatif. Si un saut n’est pas présent, le synthétiseur détermine le saut entre les mots en fonction du contexte linguistique.