向SpeechSynthesizer添加新语言 [英] Adding a new Language to SpeechSynthesizer
问题描述
因此,我正在尝试为SpeechSynthesizer添加一种新的语言,尤其是挪威语,但似乎没有安装。
So I'am trying to add a new language, spesifically norwegian, to SpeechSynthesizer, but it doesn't seem to get installed.
发现了这个:
在.NET语音中添加其他声音
(但是这里的问题是不支持捷克语)
Found this: Add another voice into .NET Speech (But here the problem is that Czech isn't supported)
我已经安装了挪威语从这里打包:
http:// www。 microsoft.com/en-us/download/details.aspx?id=27224
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);
}
但仅输出:
Microsoft Zira Desktop-英文(美国)
已检查文本转语音工具,这也是唯一的选择。
还尝试注销/登录并重新启动计算机。
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?
推荐答案
您可能需要向Windows 10添加语音语言,并设置区域设置,国家/地区,Windows显示语言和语音语言,以便它们都与Cortana支持的语言环境之一保持一致
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.
要确认设置是否正确:
-
打开设置。选择时间和时间语言,然后是Region&语言。
Open Settings. Select Time& language, and then Region & Language.
检查Windows显示语言的语言(默认设置)设置。如果所需的语言不可用,请添加所需的语言:
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.
检查国家或地区设置。确保所选国家/地区与语言设置中设置的Windows显示语言相对应。
Check the Country or region setting. Make sure the country selected corresponds with the Windows display language set in the Language setting.
返回设置和时间&语言,然后选择语音。检查语音语言设置,并确保它与以前的设置一致。
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.
正确完成上述操作后,您的语言应出现在SpeechSynthesizer.AllVoices集合中。然后,您应该能够将此语音分配给SpeechSynthesizer实例的Voice属性:
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, "");
}
这篇关于向SpeechSynthesizer添加新语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!