Share via


PromptBuilder.AppendSsml Méthode

Définition

Ajoute un fichier SSML à un objet PromptBuilder.

Surcharges

AppendSsml(String)

Ajoute le fichier SSML au niveau du chemin spécifié à l'objet PromptBuilder.

AppendSsml(Uri)

Ajoute le fichier SSML au niveau de l'URI spécifié à l'objet PromptBuilder.

AppendSsml(XmlReader)

Ajoute un objet XMLReader qui référence une invite SSML à l’objet PromptBuilder.

AppendSsml(String)

Ajoute le fichier SSML au niveau du chemin spécifié à l'objet PromptBuilder.

public:
 void AppendSsml(System::String ^ path);
public void AppendSsml (string path);
member this.AppendSsml : string -> unit
Public Sub AppendSsml (path As String)

Paramètres

path
String

Chemin qualifié complet au fichier SSML à ajouter.

Exemples

L’exemple qui suit crée un PromptBuilder objet et ajoute le contenu d’un fichier SSML à l’aide de la AppendSsml méthode.

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

        // Create a PromptBuilder object and append a file that defines an SSML prompt.  
        PromptBuilder ssmlFile = new PromptBuilder();  
        ssmlFile.AppendSsml("c:\\test\\Weather.ssml");  

        // Speak the contents of the SSML prompt.  
        synth.Speak(ssmlFile);  
      }  

      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  
  }  
}  

Voici le fichier SSML que l’exemple précédent référence.

<?xml version="1.0" encoding="ISO-8859-1"?>  
<speak version="1.0"  
 xmlns="http://www.w3.org/2001/10/synthesis"  
 xml:lang="en-US">  

  <s> The weather forecast for today is partly cloudy with some sun breaks. </s>  

</speak>  

Remarques

Le fichier SSML doit être un fichier de format XML conforme à la spécification de la Version 1,0 du langage de synthèse vocale (SSML) .

Vous pouvez également ajouter le balisage SSML sous forme de chaîne à l’aide de AppendSsmlMarkup .

S’applique à

AppendSsml(Uri)

Ajoute le fichier SSML au niveau de l'URI spécifié à l'objet PromptBuilder.

public:
 void AppendSsml(Uri ^ ssmlFile);
public void AppendSsml (Uri ssmlFile);
member this.AppendSsml : Uri -> unit
Public Sub AppendSsml (ssmlFile As Uri)

Paramètres

ssmlFile
Uri

URI qualifié complet au fichier SSML à ajouter.

Exemples

L’exemple qui suit crée un PromptBuilder objet et ajoute le contenu d’un fichier SSML à l’aide de la AppendSsml méthode.

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

        // Create a PromptBuilder object and append a file that defines an SSML prompt.  
        PromptBuilder ssmlFile = new PromptBuilder();  
        ssmlFile.AppendSsml(new Uri("c:\\test\\Weather.ssml"));  

        // Speak the contents of the SSML prompt.  
        synth.Speak(ssmlFile);  
      }  

      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  
  }  
}  

Voici le fichier SSML que l’exemple précédent référence.

<?xml version="1.0" encoding="ISO-8859-1"?>  
<speak version="1.0"  
 xmlns="http://www.w3.org/2001/10/synthesis"  
 xml:lang="en-US">  

  <s> The weather forecast for today is partly cloudy with some sun breaks. </s>  

</speak>  

Remarques

Le fichier SSML doit être un fichier de format XML conforme à la spécification de la Version 1,0 du langage de synthèse vocale (SSML) .

Vous pouvez également ajouter le balisage SSML sous forme de chaîne à l’aide de AppendSsmlMarkup .

S’applique à

AppendSsml(XmlReader)

Ajoute un objet XMLReader qui référence une invite SSML à l’objet PromptBuilder.

public:
 void AppendSsml(System::Xml::XmlReader ^ ssmlFile);
public void AppendSsml (System.Xml.XmlReader ssmlFile);
member this.AppendSsml : System.Xml.XmlReader -> unit
Public Sub AppendSsml (ssmlFile As XmlReader)

Paramètres

ssmlFile
XmlReader

Nom qualifié complet au fichier XML à ajouter.

Exemples

L’exemple suivant crée un PromptBuilder objet à partir d’un XmlReader objet qui fait référence à un fichier contenant le balisage de langage de synthèse vocale (SSML).

using System;  
using System.Xml;  
using System.IO;  
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");  

        // Create the path to the SSML file.  
        string weatherFile = Path.GetFullPath("c:\\test\\Weather.xml");  
        PromptBuilder builder = null;  

        // Create an XML Reader from the file, create a PromptBuilder and   
        // append the XmlReader.  
        if (File.Exists(weatherFile))  
        {  
          XmlReader reader = XmlReader.Create(weatherFile);  
          builder = new PromptBuilder();  
          builder.AppendSsml(reader);  
          reader.Close();  
        }  

        // 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

Le fichier SSML doit être un fichier de format XML conforme à la spécification de la Version 1,0 du langage de synthèse vocale (SSML) .

Vous pouvez également ajouter le balisage SSML sous forme de chaîne à l’aide de AppendSsmlMarkup .

S’applique à