DELPHI 开发语音程序 TTS
程序代码:实现方法非常简单希望对你有帮助
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,VTxtAuto_TLB, StdCtrls, Buttons, OleServer, SpeechLib_TLB, ComCtrls;
type
TForm2 = class(TForm)
ListBox1: TListBox;
Label1: TLabel;
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
SpVoice1: TSpVoice;
istokens:ISpeechObjectTokens;
istoken :ISpeechObjectToken;
i:integer;
tts:IVTxtAuto;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
istoken:=istokens.Item(ListBox1.ItemIndex);
spvoice1.Voice:=istoken;
SpVoice1.Speak(Edit1.Text, SVSFDefault);
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
spvoice1:=TSpVoice.Create(nil);
istokens:=spvoice1.GetVoices('','');
for i:=0 to istokens.Count-1 do
begin
istoken:=istokens.Item(i);
ListBox1.Items.AddObject(istoken.GetDescription(0),TObject(istoken));
end;
end;
end.
- 上一篇:SWF 文件剖解与生成
- 下一篇:DELPHI 振屏的实现(窗口抖动)




