PromptBuilder.AppendText メソッド

定義

PromptBuilder オブジェクトにテキストを追加します。

オーバーロード

名前 説明
AppendText(String)

PromptBuilder オブジェクトに追加するテキストを指定します。

AppendText(String, PromptEmphasis)

PromptBuilder オブジェクトにテキストを追加し、テキストの強調度を指定します。

AppendText(String, PromptRate)

PromptBuilder オブジェクトにテキストを追加し、テキストの読み上げ速度を指定します。

AppendText(String, PromptVolume)

PromptBuilder オブジェクトにテキストを追加し、テキストを読み上げるボリュームを指定します。

AppendText(String)

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

PromptBuilder オブジェクトに追加するテキストを指定します。

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

パラメーター

textToSpeak
String

読み上げるテキストを含む文字列。

次の例では、 PromptBuilder オブジェクトを作成し、 AppendText メソッドを使用してテキスト文字列を追加します。

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 text string.
        PromptBuilder speakText = new PromptBuilder();
        speakText.AppendText("Say the name of the song you want to hear");

        // Speak the contents of the prompt.
        synth.Speak(speakText);
      }

      Console.WriteLine();
      Console.WriteLine("Press any key to exit...");
      Console.ReadKey();
    }
  }
}

注釈

SSML マークアップ言語として書式設定されたテキストを追加するには、 AppendSsmlMarkupを使用します。

適用対象

AppendText(String, PromptEmphasis)

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

PromptBuilder オブジェクトにテキストを追加し、テキストの強調度を指定します。

public:
 void AppendText(System::String ^ textToSpeak, System::Speech::Synthesis::PromptEmphasis emphasis);
public void AppendText(string textToSpeak, System.Speech.Synthesis.PromptEmphasis emphasis);
member this.AppendText : string * System.Speech.Synthesis.PromptEmphasis -> unit
Public Sub AppendText (textToSpeak As String, emphasis As PromptEmphasis)

パラメーター

textToSpeak
String

読み上げるテキストを含む文字列。

emphasis
PromptEmphasis

テキストに適用する強調またはストレスの値。

注釈

Windowsの音声合成エンジンは、現時点では強調パラメーターをサポートしていません。 強調パラメーターの値を設定すると、合成された音声出力に聞こえる変化は生じなくなります。

適用対象

AppendText(String, PromptRate)

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

PromptBuilder オブジェクトにテキストを追加し、テキストの読み上げ速度を指定します。

public:
 void AppendText(System::String ^ textToSpeak, System::Speech::Synthesis::PromptRate rate);
public void AppendText(string textToSpeak, System.Speech.Synthesis.PromptRate rate);
member this.AppendText : string * System.Speech.Synthesis.PromptRate -> unit
Public Sub AppendText (textToSpeak As String, rate As PromptRate)

パラメーター

textToSpeak
String

読み上げるテキストを含む文字列。

rate
PromptRate

テキストに適用する読み上げ速度の値。

次の例では、 PromptBuilder オブジェクトを作成し、テキスト文字列を追加します。 この例では、 AppendText メソッドを使用して、追加する文字列の低速読み上げ速度を指定し、注文の内容を列挙します。

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 add content.
        PromptBuilder speakRate = new PromptBuilder();
        speakRate.AppendText("Your order for");
        speakRate.AppendText("one kitchen sink and one faucet", PromptRate.Slow);
        speakRate.AppendText("has been confirmed.");

        // Speak the contents of the SSML prompt.
        synth.Speak(speakRate);
      }

      Console.WriteLine();
      Console.WriteLine("Press any key to exit...");
      Console.ReadKey();
    }
  }
}

適用対象

AppendText(String, PromptVolume)

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

PromptBuilder オブジェクトにテキストを追加し、テキストを読み上げるボリュームを指定します。

public:
 void AppendText(System::String ^ textToSpeak, System::Speech::Synthesis::PromptVolume volume);
public void AppendText(string textToSpeak, System.Speech.Synthesis.PromptVolume volume);
member this.AppendText : string * System.Speech.Synthesis.PromptVolume -> unit
Public Sub AppendText (textToSpeak As String, volume As PromptVolume)

パラメーター

textToSpeak
String

読み上げるテキストを含む文字列。

volume
PromptVolume

テキストに適用する読み上げ音量 (ラウドネス) の値。

次の例では、 AppendText メソッドを使用して、 SpeechSynthesizer が音声出力に適用する必要があるボリューム設定を指定します。

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

        // Build a prompt that applies different volume settings.
        PromptBuilder builder = new PromptBuilder();
        builder.AppendText("This is the default speaking volume.", PromptVolume.Default);
        builder.AppendBreak();
        builder.AppendText("This is the extra loud speaking volume.", PromptVolume.ExtraLoud);
        builder.AppendBreak();
        builder.AppendText("This is the medium speaking volume.", PromptVolume.Medium);

        // Speak the prompt.
        synth.Speak(builder);
      }

      Console.WriteLine();
      Console.WriteLine("Press any key to exit...");
      Console.ReadKey();
    }
  }
}

注釈

DefaultPromptVolume設定はフル ボリュームであり、ExtraLoudと同じです。 その他の設定では、音声出力のボリュームがフル ボリュームに対して減少します。

適用対象