SpeechSynthesizer.Speak 메서드

정의

문자열, Prompt 개체 또는 PromptBuilder 개체로부터 음성 출력을 동기적으로 생성합니다.

오버로드

Speak(Prompt)

Prompt 객체의 내용을 동기적으로 말합니다.

Speak(PromptBuilder)

PromptBuilder 객체의 내용을 동기적으로 말합니다.

Speak(String)

문자열의 내용을 동기적으로 말합니다.

설명

메서드는 Speak 음성을 동기적으로 생성합니다. 메서드는 instance 내용이 Speak 완전히 말할 때까지 반환되지 않습니다. 이는 음성을 생성하는 가장 간단한 방법입니다. 그러나 말하는 동안 작업을 수행 해야 하는 애플리케이션, 예를 들어 텍스트 강조 표시, 페인트 애니메이션, 모니터 컨트롤 또는 기타 작업을 사용 합니다 SpeakAsync 메서드 또는 SpeakSsmlAsync 음성을 비동기적으로 생성 하는 방법입니다.

이 메서드를 호출하는 동안 은 SpeechSynthesizer 다음 이벤트를 발생할 수 있습니다.

  • StateChanged. 신시사이저의 말하기 상태가 변경될 때 발생합니다.

  • SpeakStarted. 신시사이저가 음성 생성을 시작할 때 발생합니다.

  • PhonemeReached. 신시사이저가 언어로 음성의 신중한 소리를 구성하는 문자 또는 문자의 조합에 도달 할 때마다 발생합니다.

  • SpeakProgress. 신시사이저가 단어 말하기를 완료할 때마다 발생합니다.

  • VisemeReached. 음성 출력이 발생할 때마다 발생하려면 입이나 음성을 생성하는 데 사용되는 얼굴 근육의 위치를 변경해야 합니다.

  • BookmarkReached. 프롬프트에서 신시사이저가 책갈피를 발견할 때 발생합니다.

  • VoiceChange. 신시사이저의 말하기 음성이 변경될 때 발생합니다.

SpeechSynthesizer 메서드를 SpeakCompleted 처리하는 Speak 동안 이벤트를 발생시키지 않습니다.

Speak(Prompt)

Source:
SpeechSynthesizer.cs
Source:
SpeechSynthesizer.cs

Prompt 객체의 내용을 동기적으로 말합니다.

public:
 void Speak(System::Speech::Synthesis::Prompt ^ prompt);
public void Speak (System.Speech.Synthesis.Prompt prompt);
member this.Speak : System.Speech.Synthesis.Prompt -> unit
Public Sub Speak (prompt As Prompt)

매개 변수

prompt
Prompt

말할 콘텐츠입니다.

예제

다음 예제에서는 Prompt 개체를 문자열에서 개체를 인수로 전달 합니다 Speak 메서드.

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 prompt from a string.
        Prompt color = new Prompt("What is your favorite color?");

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

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

설명

개체의 내용을 비동기적으로 말하려면 을 Prompt 사용합니다 SpeakAsync.

적용 대상

Speak(PromptBuilder)

Source:
SpeechSynthesizer.cs
Source:
SpeechSynthesizer.cs

PromptBuilder 객체의 내용을 동기적으로 말합니다.

public:
 void Speak(System::Speech::Synthesis::PromptBuilder ^ promptBuilder);
public void Speak (System.Speech.Synthesis.PromptBuilder promptBuilder);
member this.Speak : System.Speech.Synthesis.PromptBuilder -> unit
Public Sub Speak (promptBuilder As PromptBuilder)

매개 변수

promptBuilder
PromptBuilder

말할 콘텐츠입니다.

예제

다음 예제에서는 PromptBuilder 개체를 문자열에서 개체를 인수로 전달 합니다 Speak 메서드.

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

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

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

설명

개체의 내용을 비동기적으로 말하려면 을 PromptBuilder 사용합니다 SpeakAsync.

적용 대상

Speak(String)

Source:
SpeechSynthesizer.cs
Source:
SpeechSynthesizer.cs

문자열의 내용을 동기적으로 말합니다.

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

매개 변수

textToSpeak
String

읽을 텍스트입니다.

예제

다음 예제와 같이 메서드는 Speak 음성 출력을 동기적으로 생성하는 가장 간단한 방법을 제공합니다.

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

        // Speak a string synchronously.
        synth.Speak("What is your favorite color?");
      }

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

설명

SSML 태그가 포함된 문자열을 동기적으로 말하려면 메서드를 SpeakSsml 사용합니다. 문자열의 내용을 비동기적으로 말하려면 메서드를 SpeakAsync 사용합니다.

적용 대상