Partilhar via


PromptBuilder.AppendSsml Método

Definição

Acrescenta um arquivo SSML a um PromptBuilder objeto.

Sobrecargas

Nome Description
AppendSsml(String)

Acrescenta o arquivo SSML no caminho especificado para o PromptBuilder objeto.

AppendSsml(Uri)

Acrescenta o arquivo SSML no URI especificado ao PromptBuilder objeto.

AppendSsml(XmlReader)

Acrescenta um XMLReader objeto que faz referência a um prompt SSML ao PromptBuilder objeto.

AppendSsml(String)

Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs

Acrescenta o arquivo SSML no caminho especificado para o 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

Um caminho totalmente qualificado para o arquivo SSML a ser acrescentado.

Exemplos

O exemplo a seguir cria um PromptBuilder objeto e acrescenta o conteúdo de um arquivo SSML usando o 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();
    }
  }
}

Veja a seguir o arquivo SSML que o exemplo anterior faz referência.

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

Comentários

O arquivo SSML deve ser um arquivo em formato XML que esteja em conformidade com a especificação SSML (Speech Synthesis Markup Language) versão 1.0 .

Você também pode acrescentar a marcação SSML como uma cadeia de caracteres usando AppendSsmlMarkup.

Aplica-se a

AppendSsml(Uri)

Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs

Acrescenta o arquivo SSML no URI especificado ao 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

Um URI totalmente qualificado para o arquivo SSML a ser acrescentado.

Exemplos

O exemplo a seguir cria um PromptBuilder objeto e acrescenta o conteúdo de um arquivo SSML usando o 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();
    }
  }
}

Veja a seguir o arquivo SSML que o exemplo anterior faz referência.

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

Comentários

O arquivo SSML deve ser um arquivo em formato XML que esteja em conformidade com a especificação SSML (Speech Synthesis Markup Language) versão 1.0 .

Você também pode acrescentar a marcação SSML como uma cadeia de caracteres usando AppendSsmlMarkup.

Importante

Chamar métodos dessa classe com dados não confiáveis é um risco à segurança. Chame os métodos dessa classe apenas com dados confiáveis. Para obter mais informações, consulte Validar Todas as Entradas.

Aplica-se a

AppendSsml(XmlReader)

Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs
Origem:
PromptBuilder.cs

Acrescenta um XMLReader objeto que faz referência a um prompt SSML ao 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

Um nome totalmente qualificado para o arquivo XML a ser acrescentado.

Exemplos

O exemplo a seguir cria um PromptBuilder objeto de um XmlReader objeto que faz referência a um arquivo que contém a marcação SSML (Speech Synthesis Markup Language).

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

Comentários

Importante

Usar uma instância desse tipo com dados não confiáveis é um risco à segurança. Use esse objeto somente com dados confiáveis. Para obter mais informações, consulte Validar Todas as Entradas.

O arquivo SSML deve ser um arquivo em formato XML que esteja em conformidade com a especificação SSML (Speech Synthesis Markup Language) versão 1.0 .

Você também pode acrescentar a marcação SSML como uma cadeia de caracteres usando AppendSsmlMarkup.

Aplica-se a