PromptBuilder.AppendSsml 메서드

정의

SSML 파일을 PromptBuilder 개체에 추가합니다.

오버로드

AppendSsml(String)

지정된 경로의 SSML 파일을 PromptBuilder 개체에 추가합니다.

AppendSsml(Uri)

지정된 URI의 SSML 파일을 PromptBuilder 개체에 추가합니다.

AppendSsml(XmlReader)

SSML 프롬프트를 참조하는 XMLReader 개체를 PromptBuilder 개체에 추가합니다.

AppendSsml(String)

지정된 경로의 SSML 파일을 PromptBuilder 개체에 추가합니다.

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

매개 변수

path
String

추가할 SSML 파일의 정규화된 경로입니다.

예제

다음 예제에서는 개체를 만들고 PromptBuilder 메서드를 사용 하 여 SSML 파일의 내용을 추가 합니다 AppendSsml .

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

다음은 앞의 예제를 참조 하는 SSML 파일입니다.

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

설명

SSML 파일은 ssml (Speech 합성 Markup Language) 버전 1.0 사양을 준수 하는 XML 형식 파일 이어야 합니다.

를 사용 하 여 SSML 태그를 문자열로 추가할 수도 있습니다 AppendSsmlMarkup .

적용 대상

AppendSsml(Uri)

지정된 URI의 SSML 파일을 PromptBuilder 개체에 추가합니다.

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

매개 변수

ssmlFile
Uri

추가할 SSML 파일의 정규화된 URI입니다.

예제

다음 예제에서는 개체를 만들고 PromptBuilder 메서드를 사용 하 여 SSML 파일의 내용을 추가 합니다 AppendSsml .

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

다음은 앞의 예제를 참조 하는 SSML 파일입니다.

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

설명

SSML 파일은 ssml (Speech 합성 Markup Language) 버전 1.0 사양을 준수 하는 XML 형식 파일 이어야 합니다.

를 사용 하 여 SSML 태그를 문자열로 추가할 수도 있습니다 AppendSsmlMarkup .

적용 대상

AppendSsml(XmlReader)

SSML 프롬프트를 참조하는 XMLReader 개체를 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)

매개 변수

ssmlFile
XmlReader

추가할 XML 파일의 정규화된 이름입니다.

예제

다음 예제에서는 PromptBuilder XmlReader 개체에서 SSML (Speech 합성 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();  
    }  
  }  
}  

설명

SSML 파일은 ssml (Speech 합성 Markup Language) 버전 1.0 사양을 준수 하는 XML 형식 파일 이어야 합니다.

를 사용 하 여 SSML 태그를 문자열로 추가할 수도 있습니다 AppendSsmlMarkup .

적용 대상