System.Speech.Synthesis как изменить голос с en-US на en-GB?

Я смотрел везде в Интернете. Я узнал, как изменить пол голоса (synthesizer.SelectVoiceByHints(VoiceGender.Male) и возраст голоса, но я не могу понять, как изменить культуру голоса (он же добавить британский акцент).

Другим жизнеспособным вариантом было бы найти другой голосовой синтезатор. Однако, когда я попытался внедрить его в свою программу, синтезатор голоса не заработал.

Спасибо большое за вашу помощь!


person Hychet    schedule 21.12.2016    source источник


Ответы (2)


За две недели до этого я разработал инструмент Speech Synthesizer для французского и английского языков. Я выполнил следующие шаги, чтобы установить больше голосов и настроить разные голоса, вызвав метод 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

Надеюсь, это дает некоторое представление.

person Saravanan Sachi    schedule 21.12.2016

Изучив документацию SpeechSynthesizer, я нашел Voice типа VoiceInfo. В VoiceInfo есть еще одно свойство под названием Culture. Я думаю, вы должны установить это свойство.

Что-то вроде этого:

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