1. 先到該網站下載微軟的Speech SDK5.1 讓windows作業系統擁有中文語音
https://www.microsoft.com/en-us/download/confirmation.aspx?id=10121
2. 然後在C# 加入參考
"COM元件中選擇Microsoft Speech Object Library 5.4"
3. 以下為範例程式碼
SpVoiceClass voice = new SpVoiceClass();
voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0);//Item(0)中文女聲
voice.Speak("歡迎來到文字轉語音系統", SpeechVoiceSpeakFlags.SVSFDefault);
System.Threading.Thread.Sleep(3000);
voice.Speak("注意,SPC超過警戒值上限", SpeechVoiceSpeakFlags.SVSFDefault);
System.Threading.Thread.Sleep(3000);
voice.Speak("警告,SPC超過規格上限", SpeechVoiceSpeakFlags.SVSFDefault);