Share via


PromptBuilder.AppendSsml Método

Definición

Anexa un archivo SSML a un objeto PromptBuilder.

Sobrecargas

AppendSsml(String)

Anexa el archivo SSML en la ruta de acceso especificada al objeto PromptBuilder.

AppendSsml(Uri)

Anexa el archivo SSML en el URI especificado al objeto PromptBuilder.

AppendSsml(XmlReader)

Agrega un objeto XMLReader que define una referencia de un mensaje de SSML al objeto PromptBuilder.

AppendSsml(String)

Anexa el archivo SSML en la ruta de acceso especificada al objeto PromptBuilder.

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

Parámetros

path
String

Ruta de acceso completa al archivo SSML que se va a anexar.

Ejemplos

En el ejemplo siguiente se crea un PromptBuilder objeto y se anexa el contenido de un archivo SSML mediante el AppendSsml método .

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

A continuación se muestra el archivo SSML al que hace referencia el ejemplo anterior.

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

Comentarios

El archivo SSML debe ser un archivo de formato XML que se ajuste a la especificación del lenguaje de marcado de síntesis de voz (SSML) versión 1.0.

También puede anexar el marcado SSML como una cadena mediante AppendSsmlMarkup .

Se aplica a

AppendSsml(Uri)

Anexa el archivo SSML en el URI especificado al objeto PromptBuilder.

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

Parámetros

ssmlFile
Uri

URI completo del archivo SSML que se va a anexar.

Ejemplos

En el ejemplo siguiente se crea un PromptBuilder objeto y se anexa el contenido de un archivo SSML mediante el AppendSsml método .

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

A continuación se muestra el archivo SSML al que hace referencia el ejemplo anterior.

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

Comentarios

El archivo SSML debe ser un archivo de formato XML que se ajuste a la especificación del lenguaje de marcado de síntesis de voz (SSML) versión 1.0.

También puede anexar el marcado SSML como una cadena mediante AppendSsmlMarkup .

Se aplica a

AppendSsml(XmlReader)

Agrega un objeto XMLReader que define una referencia de un mensaje de SSML al objeto 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)

Parámetros

ssmlFile
XmlReader

Nombre completo del archivo XML que se va a anexar.

Ejemplos

En el ejemplo siguiente se crea un objeto a partir de un objeto que hace referencia a un archivo que contiene marcado de lenguaje de marcado de síntesis de PromptBuilder XmlReader voz (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();  
    }  
  }  
}  

Comentarios

El archivo SSML debe ser un archivo de formato XML que se ajuste a la especificación del lenguaje de marcado de síntesis de voz (SSML) versión 1.0.

También puede anexar el marcado SSML como una cadena mediante AppendSsmlMarkup .

Se aplica a