雜誌翻譯推薦在很多的工場利用中,常需要利用文字轉語音的體例提示操作人員或是工程師領會今朝生產狀態,警報或是即時訊息的通知,哄騙微軟供應的Speech API,可以很輕鬆完成此項程式開辟應用翻譯

2.說明:
有關Microsoft Speech API的說明請參考MSDN:
http://msdn.microsoft.com/en-us/library/ee125663(v=vs.85).aspx

加入參考
在COM元件中選擇Microsoft Speech Object Library 5.4

到場定名空間:

1.前言:

using SpeechLib;

應用一:

private void button1_Click(object sender, EventArgs e)
{
SpVoiceClass voice = new SpVoiceClass();
voice.Voice = voice.GetVoices(string.Empty翻譯社 string.Empty).Item(2);//Item(2)女聲
voice.Speak("Welcome to text to speech system.", SpeechVoiceSpeakFlags.SVSFDefault);//SVSFDefault: Specifies that the default settings

System.Threading.Thread.Sleep(3000);
voice.Speak("Warning, SPC chart is out of upper control limit!", SpeechVoiceSpeakFlags.SVSFDefault);

System.Threading.Thread.Sleep(3000);
voice.Speak("Alarm翻譯社 SPC chart is out of upper spec limit!", SpeechVoiceSpeakFlags.SVSFDefault);
}

應用三:

private void Form1_Load(object sender翻譯社 EventArgs e)
{
SpVoiceClass voice = new SpVoiceClass();
voice.Voice = voice.GetVoices(string.Empty翻譯社 string.Empty).Item(1);//Item(1)男聲
voice.Speak("You got e-mail", SpeechVoiceSpeakFlags.SVSFlagsAsync);//SVSFlagsAsync: Specifies that the Speak call should be asynchronous. That is, it will return immediately after the speak request is queued.
}

應用二:

private void button2_Click(object sender, EventArgs e)
{
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);
}
文章標籤
C# text-to-speech 文字轉語音


文章出自: http://einboch.pixnet.net/blog/post/267347720-c%23%e7%9a%84%e6%96%87%e5%ad%97%e8%bd%89%e8%aa%9e%e9%9有關各國語文翻譯公證的問題歡迎諮詢華頓翻譯公司02-77260932
arrow
arrow
    全站熱搜