private void writeWavFile(string message)
{
SpeechLib.SpeechVoiceSpeakFlags SpFlags;
SpeechLib.ISpeechVoice voice = null;
SpFlags = SpeechLib.SpeechVoiceSpeakFlags.SVSFlagsAsync;
voice = new SpeechLib.SpVoice();
string fileName = "D:/VoiceContent" + System.DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".wav";
SpeechLib.SpeechStreamFileMode SSFM = SpeechLib.SpeechStreamFileMode.SSFMCreateForWrite;
SpeechLib.SpFileStream SFS = new SpeechLib.SpFileStreamClass();
SFS.Open(fileName, SSFM, false);
voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0);
////音量
//voice.Volume = 100;
voice.AudioOutputStream = SFS;
voice.Speak(message, SpFlags);
voice.WaitUntilDone(System.Threading.Timeout.Infinite);
SFS.Close();
}
{
writeWavFile("你好,請稍等!");
}