Through the "System.Speech.DLL" Get voice pack problem.

驰 陈 21 Reputation points
2020-11-12T01:06:49.447+00:00

Hello, everyone.
I'm using the WPF programming tool on Win10, my job needs to install the multi-language voice packs for testing the Text-To-Speech on my current OS.
So far, I have installed Japanese, Korean, French, German, Italian, and Portugal 6 language packs. But only the Japanese, Korean, French, German, and Italian can be accessed through "System.Speech.DLL" the GetInstalledVoices().
My question is there any limitation for using the Text-To-Speech with WPF programming application?
What is the reason for this? can anyone help me?
Thank you.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,762 questions
{count} votes

Accepted answer
  1. DaisyTian-1203 11,621 Reputation points
    2020-11-13T06:16:14.867+00:00

    I used UWP api to get Portugal in my WPF project, and below is my steps:

    Step1: Right click References>Add Reference... > Browse> C:Program Files (x86)/Windows Kits/10/UnionMetadata/.winmd. Add it to your project as a reference. Note: You will need to change the filter to “All Files”.

    Step 2: Refer to Step 1 to add System.Runtime.WindowsRuntime.dll to your project. Path: “C:/Program Files (x86)/Reference Assemblies/MicrosoftFramework/.NETCore/v4.5”

    Step 3: Then use below code to get the Install voices:

     private void Button_Click(object sender, RoutedEventArgs e)  
            {  
                using (SpeechSynthesizer synthesizer = new SpeechSynthesizer())  
                {  
                    List<VoiceInformation> voiceInfolt =  
                        (  
                            from voice in SpeechSynthesizer.AllVoices  
                            select voice  
                        ).ToList();  
                    foreach (VoiceInformation info in voiceInfolt)  
                    {  
                        if (info.Language == "pt-PT")  
                        {  
                            txt.Text = info.Language;  
                        }  
                    }  
                }  
            }  
    

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.