PromptBuilder.AppendSsml Metodo

Definizione

Aggiunge un file SSML a un PromptBuilder oggetto .

Overload

Nome Descrizione
AppendSsml(String)

Aggiunge il file SSML nel percorso specificato all'oggetto PromptBuilder .

AppendSsml(Uri)

Aggiunge il file SSML all'URI specificato all'oggetto PromptBuilder .

AppendSsml(XmlReader)

Aggiunge un XMLReader oggetto che fa riferimento a un prompt SSML all'oggetto PromptBuilder .

AppendSsml(String)

Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs

Aggiunge il file SSML nel percorso specificato all'oggetto PromptBuilder .

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

Parametri

path
String

Percorso completo del file SSML da aggiungere.

Esempio

Nell'esempio seguente viene creato un PromptBuilder oggetto e viene accodato il contenuto di un file SSML usando il AppendSsml metodo .

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

Di seguito è riportato il file SSML a cui fa riferimento l'esempio precedente.

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

Commenti

Il file SSML deve essere un file in formato XML conforme alla specifica SSML (Speech Synthesis Markup Language) versione 1.0 .

È anche possibile aggiungere markup SSML come stringa usando AppendSsmlMarkup.

Si applica a

AppendSsml(Uri)

Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs

Aggiunge il file SSML all'URI specificato all'oggetto PromptBuilder .

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

Parametri

ssmlFile
Uri

URI completo del file SSML da aggiungere.

Esempio

Nell'esempio seguente viene creato un PromptBuilder oggetto e viene accodato il contenuto di un file SSML usando il AppendSsml metodo .

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

Di seguito è riportato il file SSML a cui fa riferimento l'esempio precedente.

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

Commenti

Il file SSML deve essere un file in formato XML conforme alla specifica SSML (Speech Synthesis Markup Language) versione 1.0 .

È anche possibile aggiungere markup SSML come stringa usando AppendSsmlMarkup.

Importante

La chiamata di metodi da questa classe con dati non attendibili è un rischio per la sicurezza. Chiamare i metodi da questa classe solo con dati attendibili. Per altre informazioni, vedere Convalidare tutti gli input.

Si applica a

AppendSsml(XmlReader)

Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs
Origine:
PromptBuilder.cs

Aggiunge un XMLReader oggetto che fa riferimento a un prompt SSML all'oggetto 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)

Parametri

ssmlFile
XmlReader

Nome completo del file XML da aggiungere.

Esempio

Nell'esempio seguente viene creato un PromptBuilder oggetto da un XmlReader oggetto che fa riferimento a un file contenente markup 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();
    }
  }
}

Commenti

Importante

L'uso di un'istanza di questo tipo con dati non attendibili è un rischio per la sicurezza. Utilizzare questo oggetto solo con dati attendibili. Per altre informazioni, vedere Convalidare tutti gli input.

Il file SSML deve essere un file in formato XML conforme alla specifica SSML (Speech Synthesis Markup Language) versione 1.0 .

È anche possibile aggiungere markup SSML come stringa usando AppendSsmlMarkup.

Si applica a