PromptBuilder.AppendSsml Metoda

Definicja

Dołącza plik SSML do PromptBuilder obiektu.

Przeciążenia

AppendSsml(String)

Dołącza plik SSML w określonej ścieżce do PromptBuilder obiektu.

AppendSsml(Uri)

Dołącza plik SSML o określonym identyfikatorze URI do PromptBuilder obiektu .

AppendSsml(XmlReader)

Dołącza obiekt XMLReader, który odwołuje się do wiersza polecenia SSML do PromptBuilder obiektu .

AppendSsml(String)

Dołącza plik SSML w określonej ścieżce do PromptBuilder obiektu.

C#
public void AppendSsml (string path);

Parametry

path
String

W pełni kwalifikowana ścieżka do pliku SSML do do dołączania.

Przykłady

W poniższym przykładzie zostanie dodany obiekt , który dołącza zawartość PromptBuilder pliku SSML przy użyciu AppendSsml metody .

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

Poniżej przedstawiono plik SSML, do który odwołuje się poprzedni przykład.

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

Uwagi

Plik SSML musi być plikiem w formacie XML, który jest zgodny ze specyfikacją języka Speech Synthesis Markup Language (SSML) w wersji 1.0.

Możesz również dołączyć znacznik SSML jako ciąg przy AppendSsmlMarkup użyciu .

Dotyczy

.NET Framework 4.8 i inne wersje
Produkt Wersje
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

AppendSsml(Uri)

Dołącza plik SSML o określonym identyfikatorze URI do PromptBuilder obiektu .

C#
public void AppendSsml (Uri ssmlFile);

Parametry

ssmlFile
Uri

W pełni kwalifikowany URI do pliku SSML do dodawania.

Przykłady

W poniższym przykładzie zostanie dodany obiekt , który dołącza zawartość PromptBuilder pliku SSML przy użyciu AppendSsml metody .

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

Poniżej przedstawiono plik SSML, do który odwołuje się poprzedni przykład.

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

Uwagi

Plik SSML musi być plikiem w formacie XML, który jest zgodny ze specyfikacją języka Speech Synthesis Markup Language (SSML) w wersji 1.0.

Możesz również dołączyć znacznik SSML jako ciąg przy AppendSsmlMarkup użyciu .

Dotyczy

.NET Framework 4.8 i inne wersje
Produkt Wersje
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

AppendSsml(XmlReader)

Dołącza obiekt XMLReader, który odwołuje się do wiersza polecenia SSML do PromptBuilder obiektu .

C#
public void AppendSsml (System.Xml.XmlReader ssmlFile);

Parametry

ssmlFile
XmlReader

W pełni kwalifikowana nazwa pliku XML do do dołączania.

Przykłady

Poniższy przykład tworzy obiekt z obiektu, który odwołuje się do pliku zawierającego znacznik języka PromptBuilder XmlReader Speech Synthesis Markup Language (SSML).

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

Uwagi

Plik SSML musi być plikiem w formacie XML, który jest zgodny ze specyfikacją języka Speech Synthesis Markup Language (SSML) w wersji 1.0.

Możesz również dołączyć znacznik SSML jako ciąg przy AppendSsmlMarkup użyciu .

Dotyczy

.NET Framework 4.8 i inne wersje
Produkt Wersje
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8