全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2239
推到 Plurk!
推到 Facebook!

文字-英文語音範例程式

 
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-02-12 16:49:39 IP:61.225.xxx.xxx 未訂閱
導入 SAPI.dll (不用手工尋找,直接已經在 import type library 列表中), 這個 DLL 在列表中的名字是 :Microsoft Speech Object Library [Version 5.1]。 點 inatall... Delphi 讓你選擇包的名字和存放位置,我選擇 \bpl\Sapi_V51.dpk 然後 Delphi 自動建立 SpeechLib_TLB.pas 和編譯這個包,默認將這個庫中的 19 個元件裝到 ActiveX 頁。    //完整範例(我已測試OK) unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleServer, SpeechLib_TLB; type TForm1 = class(TForm) SpVoice1: TSpVoice; Memo1: TMemo; Button1: TButton; procedure Button1Click(Sender: TObject); procedure SpVoice1AudioLevel(Sender: TObject; StreamNumber: Integer; StreamPosition: OleVariant; AudioLevel: Integer); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); begin SpVoice1.Speak(memo1.Lines.Text,0);// <--- 預設讀當前文字 end; procedure TForm1.SpVoice1AudioLevel(Sender: TObject; StreamNumber: Integer; StreamPosition: OleVariant; AudioLevel: Integer); begin SpVoice1.Speak(memo1.Lines.Text,1); end; end.
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-02-12 17:02:15 IP:61.225.xxx.xxx 未訂閱
詳細請看SAPI.chm(sdk5.1中自帶的help)以及其中的例程。 下載地址: http://download.microsoft.com/download/speechSDK/SDK/5.1/WXP/EN-US/speechsdk51.exe http://download.microsoft.com/download/speechSDK/SDK/5.1/WXP/EN-US/speechsdk51LangPack.exe    
系統時間:2024-04-25 16:14:22
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!