2011年11月18日 星期五

[C#] 讓電腦說話 Speech SDK

在製造現場作業 工作站裡,每個作業操作流程 都會產生 通知訊息
例如: OK  、NG、混料 、作業No 錯誤 .. 等等

先前的作法是,依據 各個訊息 錄製對應的 Wav 檔案來播放
目前嘗試使用 SDK 來自動播放語音。

若安裝 基本SDK 只能播放 英文語音,若要 念中文 則需要額外安裝 LangPack


//引用
using SpeechLib;

//使用
        private void button1_Click(object sender, EventArgs e)
        {
            SpeechVoiceSpeakFlags SP = SpeechVoiceSpeakFlags.SVSFlagsAsync;
            SpVoice Voice = new SpVoice();
            Voice.AllowAudioOutputFormatChangesOnNextSet = true;
            Voice.Rate = -3; // 速度 +- 100
            Voice.Volume = 100; //音量 0~100
            Voice.Speak("Good Job", SP);  //念出 Good Job
        }



下載 範例 Source Code  檔案




Quick links

The links in this section correspond to files available for this download.
Download the files appropriate for you.
File NameSize
msttss22L.exe1.0 MBDownload
sapi.chm2.0 MBDownload
Sp5TTIntXP.exe3.0 MBDownload
SpeechSDK51.exe67.0 MBDownload
SpeechSDK51LangPack.exe81.0 MBDownload
SpeechSDK51MSM.exe131.0 MBDownload

Important File Download Details
  • If you want to download sample code, documentation, SAPI, and the U.S. English Speech engines for development purposes, download the Speech SDK 5.1 file (SpeechSDK51.exe).

  • If you want to use the Japanese and Simplified Chinese engines for development purposes, download the Speech SDK 5.1 Language Pack file (SpeechSDK51LangPack.exe) in addition to the Speech SDK 5.1 file.

  • If you want to redistribute the Speech API and/or the Speech engines to integrate and ship as a part of your product, download the Speech 5.1 SDK Redistributables file (SpeechSDK51MSM.exe).

  • If you want to get only the Mike and Mary voices redistributable for Windows XP, download Mike and Mary redistributables (Sp5TTIntXP.exe).

  • If you only want the documentation, download the Documentation file (sapi.chm).

沒有留言:

張貼留言