loading...
It's hard to tell the world we live in is either a reality or a dream.
首页 | 相册 | 标签 | 发发小疯 | 技术共享 | 脚本收集 | 博客教程 | 音乐收藏 | Flash/RIA多人联网
loading...

DELPHI 开发语音程序 TTS

[ 2008-7-1 14:01:00 | By: 宝贝得很 ]

程序代码:实现方法非常简单希望对你有帮助

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.

Re:DELPHI 开发语音程序 TTS

[ 2008-7-14 15:55:59 | By: XD(游客) ]
妈呀!
这也叫简单
个人主页 | 引用 | 返回 | 删除 | 回复

发表评论:

    大名:
    密码: (游客无须输入密码)
    主页:
    标题:
    loading...
Powered by Oblog.