This documentation is archived and is not being maintained.
SpeechSynthesizer::GetInstalledVoices Method
Visual Studio 2010
Returns all of the installed speech synthesis (text-to-speech) voices.
Assembly: System.Speech (in System.Speech.dll)
Return Value
Type: System.Collections.ObjectModel::ReadOnlyCollection<InstalledVoice>Returns a read-only collection of the voices currently installed on the system.
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(); } } }
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: