首页  编辑  

TTS语音

Tags: /超级猛料/Multi-Media.多媒体相关/   Date Created:

本人用TTS做了个背单词的EXE。省去了取词的部分,哪位富翁愿意的话,

请将之完善。也请给我寄一份。源码如下:

unit word1;

interface

uses

 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

 VTxtAuto_TLB, StdCtrls, ComCtrls, Mask, FileCtrl;

type

 TForm1 = class(TForm)

   speedtext: TStaticText;

   speed: TTrackBar;

   Button1: TButton;

   Edit1: TEdit;

   Button2: TButton;

   gettext: TLabel;

   procedure FormCreate(Sender: TObject);

   procedure stopbtnClick(Sender: TObject);

   procedure speedChange(Sender: TObject);

   procedure prebtnClick(Sender: TObject);

   procedure nextbtnClick(Sender: TObject);

   procedure FormDestroy(Sender: TObject);

   procedure Button1Click(Sender: TObject);

   procedure Button2Click(Sender: TObject);

   procedure Edit1KeyPress(Sender: TObject; var Key: Char);

 private

   { Private declarations }

 public

   { Public declarations }

 end;

var

 Form1: TForm1;

 TTS:IVTxtAuto;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);

begin

 TTS:=CoVtxtAuto_.Create;

 TTS.Register('superwords','superwords');

 speed.Position:=TTS.Get_Speed;

 speedtext.caption:='速度:'+inttostr(speed.position);

 speed.SelEnd:=speed.Position;

 //filelistbox1.Mask:= '所有文件(*.*)|*.*| 文本文件(*.txt)|*.txt';

end;

procedure TForm1.stopbtnClick(Sender: TObject);

begin

 TTS.StopSpeaking;

end;

procedure TForm1.speedChange(Sender: TObject);

begin

 TTS.Set_Speed(speed.position);

 speedtext.caption:='速度:'+inttostr(speed.position);

 speed.SelEnd:=speed.Position;

end;

procedure TForm1.prebtnClick(Sender: TObject);

begin

 TTS.AudioRewind;

end;

procedure TForm1.nextbtnClick(Sender: TObject);

begin

 TTS.AudioFastForward;

end;

procedure TForm1.FormDestroy(Sender: TObject);

begin

 TTS:=nil;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

 close;

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

 TTS.Speak(Edit1.text,vtxtst_READING);

end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);

begin

 if (length(trim(edit1.text))>0) and (key=chr(32))

 then  begin if  trim(edit1.text)=gettext.Caption

             then   begin

                    TTS.Speak(edit1.Text,vtxtst_COMMAND);

                    edit1.Clear;

                    end

             else   TTS.Speak('YOU ARE WRONG',vtxtst_STATEMENT);

       end;

end;

end.

有问题可向我提出。mailto:zyuz@china.com