SpeechSynthesizer.Volume 속성

정의

SpeechSynthesizer 개체의 출력 볼륨을 가져오거나 설정합니다.

public:
 property int Volume { int get(); void set(int value); };
public int Volume { get; set; }
member this.Volume : int with get, set
Public Property Volume As Integer

속성 값

Int32

SpeechSynthesizer의 볼륨을 0에서 100까지로 반환합니다.

예제

다음 예제에서는 SpeechSynthesizer 합성 된 음성 및 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.SetOutputToDefaultAudioDevice();  

        // Set the volume of the SpeechSynthesizer's ouput.  
        synth.Volume = 60;  

        // Build a prompt containing recorded audio and synthesized speech.  
        PromptBuilder builder = new PromptBuilder(  
          new System.Globalization.CultureInfo("en-US"));  
        builder.AppendAudio("C:\\Test\\WelcomeToContosoRadio.wav");  
        builder.AppendText(  
          "The weather forecast for today is partly cloudy with some sun breaks.");  

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

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

적용 대상