PromptBuilder.AppendSsml メソッド

定義

PromptBuilder オブジェクトに SSML ファイルを追加します。

オーバーロード

名前 説明
AppendSsml(String)

指定したパスにある SSML ファイルを PromptBuilder オブジェクトに追加します。

AppendSsml(Uri)

指定した URI にある SSML ファイルを PromptBuilder オブジェクトに追加します。

AppendSsml(XmlReader)

SSML プロンプトを参照する XMLReader オブジェクトを PromptBuilder オブジェクトに追加します。

AppendSsml(String)

ソース:
PromptBuilder.cs
ソース:
PromptBuilder.cs
ソース:
PromptBuilder.cs
ソース:
PromptBuilder.cs

指定したパスにある 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 オブジェクトを作成し、 AppendSsml メソッドを使用して SSML ファイルの内容を追加します。

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) バージョン 1.0 の 仕様に準拠した XML 形式のファイルである必要があります。

AppendSsmlMarkupを使用して、SSML マークアップを文字列として追加することもできます。

適用対象

AppendSsml(Uri)

ソース:
PromptBuilder.cs
ソース:
PromptBuilder.cs
ソース:
PromptBuilder.cs
ソース:
PromptBuilder.cs

指定した 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 オブジェクトを作成し、 AppendSsml メソッドを使用して SSML ファイルの内容を追加します。

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) バージョン 1.0 の 仕様に準拠した XML 形式のファイルである必要があります。

AppendSsmlMarkupを使用して、SSML マークアップを文字列として追加することもできます。

Important

信頼されていないデータを使用してこのクラスからメソッドを呼び出すことは、セキュリティ上のリスクです。 このクラスのメソッドは、信頼できるデータでのみ呼び出します。 詳細については、「すべての入力を検証する」を参照してください。

適用対象

AppendSsml(XmlReader)

ソース:
PromptBuilder.cs
ソース:
PromptBuilder.cs
ソース:
PromptBuilder.cs
ソース:
PromptBuilder.cs

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 ファイルの完全修飾名。

次の例では、音声合成マークアップ言語 (SSML) マークアップを含むファイルを参照するXmlReader オブジェクトからPromptBuilder オブジェクトを作成します。

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

注釈

Important

信頼されていないデータでこの型のインスタンスを使用することは、セキュリティ上のリスクです。 このオブジェクトは、信頼できるデータでのみ使用します。 詳細については、「すべての入力を検証する」を参照してください。

SSML ファイルは、 音声合成マークアップ言語 (SSML) バージョン 1.0 の 仕様に準拠した XML 形式のファイルである必要があります。

AppendSsmlMarkupを使用して、SSML マークアップを文字列として追加することもできます。

適用対象