System.Speech.Synthesis 如何将语音从 en-US 更改为 en-GB?

System.Speech.Synthesis how to change voice from en-US to en-GB?

我在网上到处都看过。我找到了如何改变声音的性别(synthesizer.SelectVoiceByHints(VoiceGender.Male)和声音的年龄,但我不知道如何改变声音的文化(又名添加英国口音).

另一个可行的选择是寻找另一个语音合成器。但是,当我尝试将它实现到我的程序中时,语音合成器将无法工作。

非常感谢您的帮助!

两周前,我开发了法语和英语的语音合成器工具。我按照以下步骤安装了更多语音,并通过调用 SelectVoiceByHints 方法配置了不同的语音。

Tools: Windows 7, Visual Studio 2013

您可以如下设置文化信息,

SpeechSynthesizer _synthesizer = new SpeechSynthesizer();
_synthesizer.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult, 0, CultureInfo.GetCultureInfo("fr-FR")); // For French
// en-US for English(US)

安装更多语音的步骤

WARNING: This involves manual edits to your registry. Do at your own risk.

Step 1 --------------------------------------------------------------------------
Install the Speech Platform v11
a) go here: http://www.microsoft.com/en-us/download/details.aspx?id=27225
b) click "Download"
c) select the "x64_SpeechPlatformRuntime\SpeechPlatformRuntime.msi"
d) run the installer (duh :P)

Step 2: --------------------------------------------------------------------------
Get the alternate voices
a) go here: http://www.microsoft.com/en-us/download/details.aspx?id=27224
b) click "Download"
c) select the voice files you want. They are the ones that have "TTS" in the file name. 
    MSSpeech_TTS_en-CA_Heather
    MSSpeech_TTS_en-GB_Hazel
    MSSpeech_TTS_en-IN_Heera
    MSSpeech_TTS_en-US_Helen
    MSSpeech_TTS_en-US_ZiraPro
    MSSpeech_TTS_en-AU_Hayley
d) run the installers for each (duh :P)

Step 3: --------------------------------------------------------------------------
Extract the registry tokens
a) Open Regedit
b) Under - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech Server\v11.0\Voices - right click the "Tokens" folder and export. Save this file to your desktop as voices1.reg so it will be easy to find later.
c) Under - HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Speech Server\v11.0\Voices - right click "Tokens" and again export it, again to the desktop. Call it voices2.reg.

Step 4: --------------------------------------------------------------------------
Edit the voices1/2 files
a) open Voices1.reg in Notepad.
b) press "cntrl + H"
c) enter \Speech Server\v11.0\ into the "Find What" field
d) enter \Speech\ into the "Replace With" field
e) click "Replace All"
f) Save File
g) Repeat a-f with the Voices2.reg file

Step 5: --------------------------------------------------------------------------
Merge the new Registry files into your registry
a) double click to "run" both Voices1.reg and Voices2.reg
b) Click "Yes" when it prompts

您现在应该可以访问 Voice Attack 和 Windows TTS 选项菜单中的新声音。此过程也可能适用于其他语音包。

来源:https://superuser.com/questions/590779/how-to-install-more-voices-to-windows-speech/872573#872573

希望这能提供一些思路。

在查看了 SpeechSynthesizer 的文档后,我发现了一个类型为 VoiceInfoVoice。在VoiceInfo中,还有一个属性叫做Culture。我猜你应该设置 属性.

像这样:

var culture = new CultureInfo("en-gb");
var voice = new VoiceInfo();
voice.Culture = culture;
yourSpeechSynthesizer.voice = voice;