delphi 谷歌api文本转换语音mp3文件


本文整理自网络,侵删。

 
    Stream : TMemoryStream;
begin
  
    Stream := TMemoryStream.Create;

    try
      
      IdHTTP1.Request.UserAgent := 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401';

      IdHTTP1.Get(TIdURI.URLEncode('http://translate.google.com/translate_tts?tl=ko&q=' + txtHangul.Text), Stream);
    finally
      MediaPlayer1.Close;
     
      Stream.SaveToFile(ExtractFilePath(Application.ExeName) + 'temp.mp3');

  
      MediaPlayer1.FileName := ExtractFilePath(Application.ExeName) + 'temp.mp3';
      MediaPlayer1.Open;
      MediaPlayer1.Play;
   end;
end;

相关阅读 >>

Delphi 通过twebbrowser文档中的id查找html元素

Delphi 去掉ide开启后弹出安全警告框

Delphi 系统托盘 trayicon

Delphi 字符串与日期格式互转

Delphi调试技巧

Delphiwindows 下编译 exe 文件时把一个外部 txt 文件编译到 exe 里面

Delphi调用wmi读取usb设备的pid和vid

Delphi deletefiles 删除目录下多个文件

Delphi unicode转换ansi

Delphi中使用goo.gl(google的缩短url服务)api

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...