VoiceInfo VoiceInfo VoiceInfo VoiceInfo Class

定義

表示已安裝的語音合成引擎。Represents an installed speech synthesis engine.

public ref class VoiceInfo
[System.Serializable]
public class VoiceInfo
type VoiceInfo = class
Public Class VoiceInfo
繼承
VoiceInfoVoiceInfoVoiceInfoVoiceInfo
屬性

範例

下列範例是主控台應用程式的一部分, 它會初始化SpeechSynthesizer物件, 並將已安裝的語音 (適用于語音合成的引擎) 清單輸出到主控台, 並示範每個語音可用的資訊。The following example is part of a console application that initializes a SpeechSynthesizer object and outputs to the console a list of the installed voices (engines for speech synthesis) and demonstrates the information that is available for each voice.

using System;  
using System.Speech.Synthesis;  
using System.Speech.AudioFormat;  
  
namespace SampleSynthesis  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  
  
      // Initialize a new instance of the SpeechSynthesizer.  
      using (SpeechSynthesizer synth = new SpeechSynthesizer())  
      {  
  
        // Output information about all of the installed voices.   
        Console.WriteLine("Installed voices -");  
        foreach (InstalledVoice voice in synth.GetInstalledVoices())  
        {  
          VoiceInfo info = voice.VoiceInfo;  
          string AudioFormats = "";  
          foreach (SpeechAudioFormatInfo fmt in info.SupportedAudioFormats)  
          {  
            AudioFormats += String.Format("{0}\n",  
            fmt.EncodingFormat.ToString());  
          }  
  
          Console.WriteLine(" Name:          " + info.Name);  
          Console.WriteLine(" Culture:       " + info.Culture);  
          Console.WriteLine(" Age:           " + info.Age);  
          Console.WriteLine(" Gender:        " + info.Gender);  
          Console.WriteLine(" Description:   " + info.Description);  
          Console.WriteLine(" ID:            " + info.Id);  
          Console.WriteLine(" Enabled:       " + voice.Enabled);  
          if (info.SupportedAudioFormats.Count != 0)  
          {  
            Console.WriteLine( " Audio formats: " + AudioFormats);  
          }  
          else  
          {  
            Console.WriteLine(" No supported audio formats found");  
          }  
  
          string AdditionalInfo = "";  
          foreach (string key in info.AdditionalInfo.Keys)  
          {  
            AdditionalInfo += String.Format("  {0}: {1}\n", key, info.AdditionalInfo[key]);  
          }  
  
          Console.WriteLine(" Additional Info - " + AdditionalInfo);  
          Console.WriteLine();  
        }  
      }  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  
  }  
}  
  

備註

語音是已安裝的語音合成引擎, 也稱為文字轉換語音引擎或 TTS 引擎。A voice is an installed speech synthesis engine, which is also referred to as a text-to-speech engine or a TTS engine. SpeechSynthesizer物件使用語音從文字產生語音。The SpeechSynthesizer object uses a voice to generate speech from text. VoiceInfo物件的屬性會識別語音並描述其特性。The properties of the VoiceInfo object identify a voice and describe its characteristics. 語音的最定義特性是它Culture的, 它會定義語音可以說話的單一語言。The most defining characteristic of a voice is its Culture, which defines the single language that a voice can speak.

屬性會傳回物件,SpeechSynthesizer其中包含目前使用中之語音的相關資訊。 VoiceInfo VoiceThe Voice property returns a VoiceInfo object that contains information about the current voice in use by the SpeechSynthesizer. 您也可以使用VoiceInfo物件來取得系統上安裝之任何語音的相關資訊, 如方法所GetInstalledVoices()傳回。You can also use a VoiceInfo object to get information about any of the voices that are installed on the system, as returned by the GetInstalledVoices() method. 如需詳細資訊,請參閱 InstalledVoiceSee InstalledVoice for more information.

屬性

AdditionalInfo AdditionalInfo AdditionalInfo AdditionalInfo

取得語音的其他相關資訊。Gets additional information about the voice.

Age Age Age Age

取得語音的年齡。Gets the age of the voice.

Culture Culture Culture Culture

取得語音的文化特性。Gets the culture of the voice.

Description Description Description Description

取得語音的描述。Gets the description of the voice.

Gender Gender Gender Gender

取得語音的性別。Gets the gender of the voice.

Id Id Id Id

取得語音的 ID。Gets the ID of the voice.

Name Name Name Name

取得語音的名稱。Gets the name of the voice.

SupportedAudioFormats SupportedAudioFormats SupportedAudioFormats SupportedAudioFormats

取得語音支援的音訊格式集合。Gets the collection of audio formats that the voice supports.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

使用指定的VoiceInfo物件來比較語音的欄位,以判斷它們是否包含相同的值。Compares the fields of the voice with the specified VoiceInfo object to determine whether they contain the same values.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

提供 VoiceInfo 物件的雜湊碼。Provides a hash code for a VoiceInfo object.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於

另請參閱