Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
421 views
in Technique[技术] by (71.8m points)

c# - Adding a new Language to SpeechSynthesizer

So I'am trying to add a new language, spesifically norwegian, to SpeechSynthesizer, but it doesn't seem to get installed.

Found this: Add another voice into .NET Speech (But here the problem is that Czech isn't supported)

I have installed the norwegian pack from here: http://www.microsoft.com/en-us/download/details.aspx?id=27224

In my code I use this to check if it is installed:

     foreach (var voice in speaker.GetInstalledVoices())
        {
            Console.WriteLine(voice.VoiceInfo.Description);
        }

But it only outputs: Microsoft Zira Desktop - English (United States)

Have checked the text-to-Speech tool were this is also the only option. Have also tried to log off/log on and restart the computer.

Anyone know how to fix this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You may need to add a Speech Language to Windows 10 and set your Locale, Country, Windows display language and Speech language so they are all aligned with one of Cortana's supported locale configurations.

To confirm the settings are set correctly:

  1. Open Settings. Select Time& language, and then Region & Language.

  2. Check the Language (set as default) setting for your Windows display language. If your desired language is not available, add your desired language:

    • Click Add Language.
    • Select your desired language from the list.
    • Select the desired locale, which is the language/country combination.
    • Click on the newly selected locale and select Options.
    • Under Download language pack, click Download.
    • Under Speech, click Download.
    • After the downloads are complete (this could take several minutes), return to the Time & Language settings.
    • Click on your new language and select Set as Default.
    • NOTE: IF you changed languages, you must sign out of your account and back in for the new setting to take effect.
  3. Check the Country or region setting. Make sure the country selected corresponds with the Windows display language set in the Language setting.

  4. Return to Settings and Time & language, and then select Speech. Check the Speech language setting, and make sure it’s aligned with the previous settings.

After you have correctly done the above, your language should appear in the SpeechSynthesizer.AllVoices collection. You should then be able to assign this voice to your SpeechSynthesizer instance's Voice property:

    private async void SpeakText(MediaElement audioPlayer, string TTS)
    {
        SpeechSynthesizer ttssynthesizer = new SpeechSynthesizer();

        //Set the Voice/Speaker to Spanish
        using (var speaker = new SpeechSynthesizer())
        {
            speaker.Voice = (SpeechSynthesizer.AllVoices.First(x => x.Gender == VoiceGender.Female && x.Language.Contains("ES")) );
            ttssynthesizer.Voice = speaker.Voice;
        }

        SpeechSynthesisStream ttsStream = await ttssynthesizer.SynthesizeTextToStreamAsync(TTS);

        audioPlayer.SetSource(ttsStream, "");
    }

http://answers.microsoft.com/en-us/windows/forum/windows_10-other_settings/speech-language-in-windows-10-home/3f04bc02-9953-40b1-951c-c1d262fc3f63?auth=1


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...