Search code examples
c#.netspeech-synthesis

How to get and use full installed text-to-speech languages list?


There is something really weird happening in Windows 10 speech synthesis.

First of all, even Windows displays different installed languages count in metro and classic control panels.

Metro app shows 5 installed languages, while classic control panel shows only 3.

I need to use Microsoft Pavel language, but my app simply don't see it!

SpeechSynthesizer ss = new SpeechSynthesizer();
var installed_voices = ss.GetInstalledVoices();

for (int i = 0; i < installed_voices.Count; i++)
    Console.WriteLine(GetVoiceInfoDesc(installed_voices[i].VoiceInfo));

static string GetVoiceInfoDesc(VoiceInfo vi)
{
    return vi.AdditionalInfo["Name"] + " (ID = " + vi.AdditionalInfo["Language"] + ", " + vi.AdditionalInfo["Age"] + ", " + vi.AdditionalInfo["Gender"] + ", " + vi.Culture + ")";
}

The code above displays only 3 installed languages.

Also, when I use

ss.SelectVoiceByHints(VoiceGender.Male, VoiceAge.Adult, 0, CultureInfo.CreateSpecificCulture("ru-RU"));

I still get Irina voice that is female.

I tested Pavel's voice and it's really installed and speaks something.

I use .net 4.0 C#. Any ideas what's happening here?

enter image description here


Solution

  • The problem that is some languages for some unknown reason can be used in metro apps only and can't be seen through SAPI.

    We can fix this by changing registry.

    This is fix example for Windows 10 x64 Pavel's voice that I took from somewhere in Internet:

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Speech\Voices\Tokens\MSTTS_V110_ruRU_PavelM]
    @="Microsoft Pavel Mobile - Russian (Russia)"
    "419"="Microsoft Pavel Mobile - Russian (Russia)"
    "CLSID"="{179F3D56-1B0B-42B2-A962-59B7EF59FE1B}"
    "LangDataPath"=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,53,\
      00,70,00,65,00,65,00,63,00,68,00,5f,00,4f,00,6e,00,65,00,43,00,6f,00,72,00,\
      65,00,5c,00,45,00,6e,00,67,00,69,00,6e,00,65,00,73,00,5c,00,54,00,54,00,53,\
      00,5c,00,72,00,75,00,2d,00,52,00,55,00,5c,00,4d,00,53,00,54,00,54,00,53,00,\
      4c,00,6f,00,63,00,72,00,75,00,52,00,55,00,2e,00,64,00,61,00,74,00,00,00
    "VoicePath"=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,53,00,\
      70,00,65,00,65,00,63,00,68,00,5f,00,4f,00,6e,00,65,00,43,00,6f,00,72,00,65,\
      00,5c,00,45,00,6e,00,67,00,69,00,6e,00,65,00,73,00,5c,00,54,00,54,00,53,00,\
      5c,00,72,00,75,00,2d,00,52,00,55,00,5c,00,4d,00,31,00,30,00,34,00,39,00,50,\
      00,61,00,76,00,65,00,6c,00,00,00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Speech\Voices\Tokens\MSTTS_V110_ruRU_PavelM\Attributes]
    "Age"="Adult"
    "DataVersion"="11.0.2013.1022"
    "Gender"="Male"
    "Language"="419"
    "Name"="Microsoft Pavel Mobile"
    "SharedPronunciation"=""
    "Vendor"="Microsoft"
    "Version"="11.0"
    

    Readme says "Thanks to Nonna Lavrukhina".