这是TTS技术! 你首先要安装这个ActiveX控件!
论坛有很多帖子,你搜索一下!
我以前写的代码:
procedure Tmian.FormCreate(Sender: TObject);
begin
FISpeech:=CoVTxtAuto_.Create;
FISpeech.Register('Demo Site','Demo App');
waveoutgetvolume(0,@ v); //得到当前的音量
end;
procedure Tmian.BitBtn1Click(Sender: TObject);
var str:string;
begin
str:=RichEdit1.SelText;
if str='' then str:=RichEdit1.Text;
if str='' then
begin
Application.MessageBox('请点击 “ 打开 ” 按钮选择您所需朗读的英文文章!','提醒!',MB_OKCANCEL);
BitBtn5.SetFocus;
exit;
end;
fispeech.StopSpeaking; //停止说
fispeech.speak(str,vtxtst_READING);//说话
end;
procedure Tmian.ScrollBar1Change(Sender: TObject);
begin
fispeech.speed:=ScrollBar1.Position; //语速设置
end;
procedure Tmian.BitBtn3Click(Sender: TObject);
begin
fispeech.AudioPause; //暂停
end;
procedure Tmian.BitBtn4Click(Sender: TObject);
begin
fispeech.AudioResume; //继续
end;
procedure Tmian.SpeedButton1Click(Sender: TObject);
begin
close;
end;