PromptBuilder.AppendSsml Método

Definición

Anexa un archivo SSML a un PromptBuilder objeto .

Sobrecargas

Nombre Description
AppendSsml(String)

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

AppendSsml(Uri)

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

AppendSsml(XmlReader)

Anexa un XMLReader objeto que hace referencia a un símbolo del sistema SSML al PromptBuilder objeto .

AppendSsml(String)

Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs

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

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

Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs

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

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

Un URI completo 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(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 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.

Importante

Llamar a métodos de esta clase con datos que no son de confianza es un riesgo de seguridad. Llame a los métodos de esta clase solo con datos de confianza. Para obtener más información, vea Validar todas las entradas.

Se aplica a

AppendSsml(XmlReader)

Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs

Anexa un XMLReader objeto que hace referencia a un símbolo del sistema SSML al PromptBuilder objeto .

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 PromptBuilder objeto a partir de un XmlReader objeto que hace referencia a un archivo que contiene marcado del lenguaje de marcado de síntesis de 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

Importante

El uso de una instancia de este tipo con datos que no son de confianza es un riesgo de seguridad. Use este objeto solo con datos de confianza. Para obtener más información, vea Validar todas las entradas.

El archivo SSML debe ser un archivo de formato XML que se ajuste a la especificación 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