C# Speech.Synthesis 在WIN10如何读出kangkang等其他语音

 2020-06-02 

1、首先查看%windir%\\Speech_OneCore\\Engines\\TTS\\zh-CN\\目录下是否存在kangkang等语音

,如果不存在,安装Microsoft Speech Platform SDK(x64)v11.0 和 安装所需的Runtime Languages(Version 11). 微软官网都有

2、修改注册表,建议先看看注册表有没有

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SPEECH\Voices\Tokens\MSTTS_V110_zhCN_KangkangM]
@="Microsoft Kangkang Mobile - Chinese (Simplified, PRC)"
"LangDataPath"="%windir%\\Speech_OneCore\\Engines\\TTS\\zh-CN\\MSTTSLocZhCN.dat"
"VoicePath"="%windir%\\Speech_OneCore\\Engines\\TTS\\zh-CN\\M2052Kangkang"
"804"="Microsoft Kangkang Mobile - Chinese (Simplified, PRC)"
"CLSID"="{179F3D56-1B0B-42B2-A962-59B7EF59FE1B}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SPEECH\Voices\Tokens\MSTTS_V110_zhCN_KangkangM\Attributes]
"Version"="11.0"
"Language"="804"
"Gender"="Male"
"Age"="Adult"
"DataVersion"="11.0.2013.1022"
"SharedPronunciation"=""
"Name"="Microsoft Kangkang Mobile"
"Vendor"="Microsoft"
"SampleText"="您已选择 %1 作为默认语音"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SPEECH\Voices\Tokens\MSTTS_V110_ZhCN_YaoyaoM]
@="Microsoft Yaoyao Mobile - Chinese (Simplified, PRC)"
"LangDataPath"="%windir%\\Speech_OneCore\\Engines\\TTS\\zh-CN\\MSTTSLoczhCN.dat"
"VoicePath"="%windir%\\Speech_OneCore\\Engines\\TTS\\zh-CN\\M2052Yaoyao"
"804"="Microsoft Yaoyao Mobile - Chinese (Simplified, PRC)"
"CLSID"="{179F3D56-1B0B-42B2-A962-59B7EF59FE1B}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SPEECH\Voices\Tokens\MSTTS_V110_zhCN_YaoyaoM\Attributes]
"Version"="11.0"
"Language"="804"
"Gender"="Female"
"Age"="Adult"
"DataVersion"="11.0.2013.1022"
"SharedPronunciation"=""
"Name"="Microsoft Yaoyao Mobile"
"Vendor"="Microsoft"
"SampleText"="您已选择 %1 作为默认语音"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SPEECH\Voices\Tokens\TTS_MS_ZH-CN_HONGYU_11.0]
@="Microsoft Hongyu Mobile - Chinese (Simplified, PRC)"
"LangDataPath"="%windir%\\Speech_OneCore\\Engines\\TTS\\zh-CN\\MSTTSLoczhCN.dat"
"VoicePath"="%windir%\\Speech_OneCore\\Engines\\TTS\\zh-CN\\M2052Hongyu"
"804"="Microsoft Hongyu Mobile - Chinese (Simplified, PRC)"
"CLSID"="{179F3D56-1B0B-42B2-A962-59B7EF59FE1B}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SPEECH\Voices\Tokens\TTS_MS_ZH-CN_HONGYU_11.0\Attributes]
"Version"="11.0"
"Language"="804"
"Gender"="Female"
"Age"="Adult"
"SharedPronunciation"=""
"Name"="Microsoft Hongyu Mobile"
"Vendor"="Microsoft"
"SampleText"="您已选择 %1 作为默认语音"
3、修改为X64模式

4、大功告成

using System.Speech.Synthesis;

SpeechSynthesizer sy = new SpeechSynthesizer();

sy.SelectVoice(this.cbx_voice.Text);

sy.Speak(this.rtbx_show.Text);