语音开发包
科飞的语音软件不错,用着很好,不到谁有针对Delphi的开发包?
[解决办法]
例程中都有,好好看看吧
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//'================================================================
//' STTS Api 声明
//'================================================================
//' 初始化
function STTSInit():boolean;stdcall; external 'STTSApi.dll';
//' 逆初始化
function STTSDeinit():boolean;stdcall;
external 'STTSApi.dll';
//' 建立与TTS服务器的连接
function STTSConnect(sSerialNumber:string;sServerIP:string):Integer;stdcall;
external 'STTSApi.dll';
//' 断开与TTS服务器的连接
Function STTSDisconnect(hTTSInstance:Integer):boolean;stdcall;
external 'STTSApi.dll';
//' 设置本次连接的合成参数
Function STTSSetParam(hTTSInstance:integer;lngType:integer;lngParam:integer):Boolean;stdcall;
external 'STTSApi.dll';
//' 获得本次连接的合成参数
Function STTSGetParam(hTTSInstance:Integer;lngType:integer;lngParam:integer):Boolean;stdcall;
external 'STTSApi.dll';
//' 从字符串合成到音频文件
Function STTSString2AudioFile(hTTSInstance:Integer;sString:string;sWaveFile:string):Boolean;stdcall;
external 'STTSApi.dll';
//' 从文本文件合成到音频文件
Function STTSFile2AudioFile(hTTSInstance:Integer;sTextFile:string;sWaveFile:string):Boolean;stdcall;
external 'STTSApi.dll';
//'播放字符串
Function STTSPlayString(hTTSInstance:Integer;sString:string;bAsynch:Boolean):Boolean;stdcall;
external 'STTSApi.dll';
//'播放文本文件
Function STTSPlayTextFile(hTTSInstance:Integer;sTextFile:string;bAsynch:Boolean):Boolean;stdcall;
external 'STTSApi.dll';
//'播放停止
Function STTSPlayStop():Boolean;stdcall;
external 'STTSApi.dll';
//'查询播放状态
Function STTSQueryPlayStatus(lngStatus:Integer):Boolean;stdcall;
external 'STTSApi.dll';
//'TTS版本信息
Function STTSAbout(sAboutInfo:string;ninfosize:Integer):Boolean;stdcall;
external 'STTSApi.dll';
//' 用来获取错误代码的Windows API函数
//Public Declare Function GetLastError Lib "kernel32" () As Long
procedure TForm1.Button1Click(Sender: TObject);
var
myhandle:integer;
begin
STTSInit();
myhandle:=STTSconnect('80','127.0.0.1');
STTSPlayString(myhandle,self.Memo1.Text,true) ;
STTSDisconnect(myhandle);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
STTSPlayStop();
end;
procedure TForm1.Button3Click(Sender: TObject);
var
strls:string;
myhandle:integer;
begin
if not self.OpenDialog1.Execute then exit;
strls:=self.OpenDialog1.FileName;
STTSInit();
myhandle:=STTSconnect('80','127.0.0.1');
STTSPlayTextFile(myhandle,strls,true);
STTSDisconnect(myhandle);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
STTSDeInit();
end;
end.