VoiceInfo Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents an installed speech synthesis engine.
public ref class VoiceInfo
[System.Serializable]
public class VoiceInfo
public class VoiceInfo
[<System.Serializable>]
type VoiceInfo = class
type VoiceInfo = class
Public Class VoiceInfo
- Inheritance
-
VoiceInfo
- Attributes
Examples
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();
}
}
}
Remarks
A voice is an installed speech synthesis engine, which is also referred to as a text-to-speech engine or a TTS engine. The SpeechSynthesizer object uses a voice to generate speech from text. The properties of the VoiceInfo object identify a voice and describe its characteristics. The most defining characteristic of a voice is its Culture, which defines the single language that a voice can speak.
The Voice property returns a VoiceInfo object that contains information about the current voice in use by the SpeechSynthesizer. 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. See InstalledVoice for more information.
Properties
AdditionalInfo |
Gets additional information about the voice. |
Age |
Gets the age of the voice. |
Culture |
Gets the culture of the voice. |
Description |
Gets the description of the voice. |
Gender |
Gets the gender of the voice. |
Id |
Gets the ID of the voice. |
Name |
Gets the name of the voice. |
SupportedAudioFormats |
Gets the collection of audio formats that the voice supports. |
Methods
Equals(Object) |
Compares the fields of the voice with the specified VoiceInfo object to determine whether they contain the same values. |
GetHashCode() |
Provides a hash code for a |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
Applies to
See also
Feedback
https://aka.ms/ContentUserFeedback.
În curând: Pe parcursul anului 2024, vom elimina treptat Probleme legate de GitHub ca mecanism de feedback pentru conținut și îl vom înlocui cu un nou sistem de feedback. Pentru mai multe informații, consultați:Trimiteți și vizualizați feedback pentru