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

3.5k views Asked by At

I've looked everywhere online. I found out how to change the gender of the voice (synthesizer.SelectVoiceByHints(VoiceGender.Male) and the age of the voice, but I can't figure out how to change the voice's culture (aka add a british accent).

Another viable option would be to find another voice synthesizer. However, when I've tried to implement it into my program the voice synthesizer won't work.

Thank you so much for your help!

2

There are 2 answers

0
Saravanan Sachi On BEST ANSWER

Two weeks before, I developed Speech Synthesizer tool for French and English. I followed below steps to install more voices and configured different voices by calling SelectVoiceByHints method.

Tools: Windows 7, Visual Studio 2013

You can set the culture info as below,

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

Steps to install more voices

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

You should now have access to the new voices in Voice Attack, and in the Windows TTS options menu. This process may also work with other voice packs.

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

Hope this gives some idea.

0
Sweeper On

After looking at the documentation of SpeechSynthesizer, I found a Voice that is of type VoiceInfo. In VoiceInfo, there is another property called Culture. I guess you should set that property.

Something like this:

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