Sdílet prostřednictvím


PromptBuilder.AppendSsml Metoda

Definice

Připojí k objektu soubor PromptBuilder SSML.

Přetížení

AppendSsml(String)

Připojí soubor SSML v zadané cestě k PromptBuilder objektu.

AppendSsml(Uri)

Připojí k objektu soubor SSML se zadaným identifikátorem PromptBuilder URI.

AppendSsml(XmlReader)

Připojí objekt XMLReader, který odkazuje na výzvu SSML na PromptBuilder objekt .

AppendSsml(String)

Připojí soubor SSML v zadané cestě k PromptBuilder objektu.

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

Parametry

path
String

Plně kvalifikovanou cestu k souboru SSML, který chcete připojit.

Příklady

Následující příklad vytvoří objekt a připojí obsah souboru PromptBuilder SSML pomocí AppendSsml metody .

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

Následuje soubor SSML, na který odkazuje předchozí příklad.

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

Poznámky

Soubor SSML musí být formátový soubor XML, který odpovídá specifikaci jazyka SSML (Speech Synthesis Markup Language) verze 1.0.

Kód SSML můžete také připojit jako řetězec pomocí AppendSsmlMarkup .

Platí pro

AppendSsml(Uri)

Připojí k objektu soubor SSML se zadaným identifikátorem PromptBuilder URI.

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

Parametry

ssmlFile
Uri

Plně kvalifikovaný identifikátor URI k souboru SSML, který se má připojit.

Příklady

Následující příklad vytvoří objekt a připojí obsah souboru PromptBuilder SSML pomocí AppendSsml metody .

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

Následuje soubor SSML, na který odkazuje předchozí příklad.

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

Poznámky

Soubor SSML musí být formátový soubor XML, který odpovídá specifikaci jazyka SSML (Speech Synthesis Markup Language) verze 1.0.

Kód SSML můžete také připojit jako řetězec pomocí AppendSsmlMarkup .

Platí pro

AppendSsml(XmlReader)

Připojí objekt XMLReader, který odkazuje na výzvu SSML na PromptBuilder objekt .

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)

Parametry

ssmlFile
XmlReader

Plně kvalifikovaný název k souboru XML, který chcete připojit.

Příklady

Následující příklad vytvoří objekt z objektu , který odkazuje na soubor obsahující kód PromptBuilder XmlReader jazyka 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();  
    }  
  }  
}  

Poznámky

Soubor SSML musí být formátový soubor XML, který odpovídá specifikaci jazyka SSML (Speech Synthesis Markup Language) verze 1.0.

Kód SSML můžete také připojit jako řetězec pomocí AppendSsmlMarkup .

Platí pro