下載地址: http://www.microsoft.com/en-us/download/details.aspx?id=10121
SeppchSDK51.exe 語音合成引擎
SpeechSDK51LangPack.exe 支持日語和簡體中文需要這個支持。
SpeechSDK51MSM.exe 如果要將引擎作為產品的一部分發布需要這個。
Sp5TTintXP.exe XP下Mike和Mary語音
sapi.chm 文檔
1.安裝SpeechSDK51.EXE
2.安裝SpeechSDK51LangPack.exe 來支持中文
3.可以在安裝文件夾找到一些示例文件,示例文件里可以找到一個生成好的Interop.SpeechLib.dll的文件,當然也可以自己生成這個文件.
簡單的代碼
1.生成wav文件,其中filename為生成的文件名。
SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpVoice Voice = new SpVoice();
SpeechStreamFileMode SpFileMode = SpeechStreamFileMode.SSFMCreateForWrite;
SpFileStream SpFileStream = new SpFileStream();
SpFileStream.Open(filename, SpFileMode, false);
Voice.AudioOutputStream = SpFileStream;
Voice.Speak(text, SpFlags);
Voice.WaitUntilDone(Timeout.Infinite);
SpFileStream.Close();
-
wav文件轉換為MP3
這里需要依賴lame
的程序[http://www.rarewares.org/mp3-lame-bundle.php]string outfile = "-b 32 --resample 22.05 -m m "" + fileName + "" "" + fileName.Replace(".wav", ".mp3") + """;
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
psi.FileName = dir + "lame.exe";
psi.Arguments = outfile;
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized;
System.Diagnostics.Process p = System.Diagnostics.Process.Start(psi);
if (waitFlag)
{
p.WaitForExit();
}