Skip to content

Instantly share code, notes, and snippets.

@tkowalczyk
Created April 13, 2013 09:35
Show Gist options
  • Save tkowalczyk/5377742 to your computer and use it in GitHub Desktop.
Save tkowalczyk/5377742 to your computer and use it in GitHub Desktop.
This method list all of the installed languages which we can use in TTS applications.
private void InstalledLang()
{
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();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment