次の方法で共有


PromptBuilder.AppendBreak メソッド

定義

PromptBuilder オブジェクトのコンテンツに中断 (一時停止) を入れます。

オーバーロード

AppendBreak()

PromptBuilder オブジェクトに中断を追加します。

AppendBreak(PromptBreak)

PromptBuilder オブジェクトに中断を追加し、強度 (継続時間) を指定します。

AppendBreak(TimeSpan)

指定された継続時間の中断を PromptBuilder オブジェクトに追加します。

AppendBreak()

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

PromptBuilder オブジェクトに中断を追加します。

public:
 void AppendBreak();
public void AppendBreak();
member this.AppendBreak : unit -> unit
Public Sub AppendBreak ()

次の例では、区切りで区切られた 2 つの文を含むプロンプトを作成し、コンピューター上の既定のオーディオ デバイスにプロンプトを読み上げます。

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 with two sentences separated by a break.
        PromptBuilder builder = new PromptBuilder(
          new System.Globalization.CultureInfo("en-US"));
        builder.AppendText(
          "Tonight's movie showings in theater A are at 5:45, 7:15, and 8:45.");
        builder.AppendBreak();
        builder.AppendText(
          "Tonight's movie showings in theater B are at 5:15, 7:30, and 9:15.");

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

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

注釈

このメソッドでは、中断の期間は指定されません。 は SpeechSynthesizer 、言語コンテキストに基づいて期間の値を決定します。

適用対象

AppendBreak(PromptBreak)

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

PromptBuilder オブジェクトに中断を追加し、強度 (継続時間) を指定します。

public:
 void AppendBreak(System::Speech::Synthesis::PromptBreak strength);
public void AppendBreak(System.Speech.Synthesis.PromptBreak strength);
member this.AppendBreak : System.Speech.Synthesis.PromptBreak -> unit
Public Sub AppendBreak (strength As PromptBreak)

パラメーター

strength
PromptBreak

中断の期間を示します。

次の例では、区切りで区切られた 2 つの文を含むプロンプトを作成し、出力を WAV ファイルに送信して再生します。

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.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");

        // Build a prompt with two sentences separated by a break.
        PromptBuilder builder = new PromptBuilder(
          new System.Globalization.CultureInfo("en-US"));
        builder.AppendText(
          "Tonight's movie showings in theater A are at 5:45, 7:15, and 8:45");
        builder.AppendBreak(PromptBreak.Medium);
        builder.AppendText(
          "Tonight's movie showings in theater B are at 5:15, 7:15, and 9:15");

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

注釈

列挙体の PromptBreak 値は、単語の境界間の分離間隔 (一時停止) の範囲を表します。 音声合成エンジンは、間隔の正確な期間を決定します。 中断が要求されると、これらの値の 1 つがテキスト読み上げ (TTS) エンジンに渡されます。このエンジンには、これらの値と対応するミリ秒の中断値の間のマッピングが含まれます。

適用対象

AppendBreak(TimeSpan)

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

指定された継続時間の中断を PromptBuilder オブジェクトに追加します。

public:
 void AppendBreak(TimeSpan duration);
public void AppendBreak(TimeSpan duration);
member this.AppendBreak : TimeSpan -> unit
Public Sub AppendBreak (duration As TimeSpan)

パラメーター

duration
TimeSpan

ティック単位の時間 (1 ティックは 100 ナノ秒)。

次の例では、15,000,000 ティック (1.5 秒) の区切りで区切られた 2 つの文を含むプロンプトを作成し、コンピューター上の既定のオーディオ デバイスにプロンプトを読み上げます。

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 with two sentences separated by a break.
        PromptBuilder builder = new PromptBuilder(
          new System.Globalization.CultureInfo("en-US"));
        builder.AppendText(
          "Tonight's movie showings in theater A are at 5:45, 7:15, and 8:45");
        builder.AppendBreak(new TimeSpan(15000000));
        builder.AppendText(
          "Tonight's movie showings in theater B are at 5:15, 7:15, and 9:15");

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

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

注釈

区切りを使用して、単語間の一時停止やその他のプロソディック境界を制御できます。 区切りは省略可能です。 区切りが存在しない場合、シンセサイザーは言語コンテキストに応じて単語間の区切りを決定します。

適用対象