不过如果仅仅使用TTS,难道也要从API SDK装到语言包吗(总共100多M)?如果要发布带语音朗读的软件,一定要用微软的再发布包(SDK Redistributables file)吗?小生经过反复的对比和研究,发现软件中SR占了很大的比重,而TTS只要有引擎就可以了。比如中文TTS,主要是一个SPTTSCHS.DLL文件,还有两个词素(Lexicon)文件。到 这里下载压缩文件,并按原路径信息解压到C:\Program Files\Common Files文件夹下(适用于XP和2003,Win2000不清楚)。当然,还需要在注册表中注册一下该引擎,下面是导出的相关部分:
Windows Registry Editor Version
5.00
[ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\MSSimplifiedChineseVoice ]
@ = " Microsoft Simplified Chinese "
" CLSID " = " {AE2CF4DB-3697-45F4-9787-0FC5A37BEB36} "
" 409 " = " Microsoft Simplified Chinese "
[ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\MSSimplifiedChineseVoice\Attributes ]
" Language " = " 804 "
" Vendor " = " Microsoft "
" Name " = " Microsoft Simplified Chinese "
" Gender " = " Male "
" Age " = " Adult "
把上面内容保存为ttscn.reg,双击导入该文件,在控制面板的“语音”(Speech)中应该可以看到语音选择中除了“Microsoft Sam”外又多了一项“Microsoft Simplified Chinese”。
[ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\MSSimplifiedChineseVoice ]
@ = " Microsoft Simplified Chinese "
" CLSID " = " {AE2CF4DB-3697-45F4-9787-0FC5A37BEB36} "
" 409 " = " Microsoft Simplified Chinese "
[ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\MSSimplifiedChineseVoice\Attributes ]
" Language " = " 804 "
" Vendor " = " Microsoft "
" Name " = " Microsoft Simplified Chinese "
" Gender " = " Male "
" Age " = " Adult "
开始玩中文TTS吧!