[英]How Can I download Text to Speech data from google translate?
I am trying to create an app that speaks Greek.我正在尝试创建一个说希腊语的应用程序。 But since Microsoft does not support Greek as a spoken language and my question on guidelines on how to create my own lexicon ( here ) I am asking this:
但是由于 Microsoft 不支持将希腊语作为口语,并且我对如何创建自己的词典的指南提出了问题( 这里),我问这个:
How may I download an mp3 (or just the data doesn't matter) that includes the text that I sent to google translate on runtime and play it using C#?我如何下载包含我在运行时发送给谷歌翻译的文本的 mp3(或者只是数据无关紧要)并使用 C# 播放?
just use this link to download the MP3:只需使用此链接下载 MP3:
http://translate.google.com/translate_tts?tl=el&q=%22hello%22
Edit: Be aware Some Browsers like Firefox replaces the %22 with " and the link doesnt work so you need to copy it and cant click it!编辑:请注意某些浏览器(如 Firefox)将 %22 替换为 " 并且链接不起作用,因此您需要复制它并且无法单击它!
How to Download Files: http://www.csharp-examples.net/download-files/如何下载文件: http : //www.csharp-examples.net/download-files/
http://msdn.microsoft.com/en-us/library/ez801hhe.aspx http://msdn.microsoft.com/en-us/library/ez801hhe.aspx
How to Play MP3: http://msdn.microsoft.com/en-us/library/4y171b18.aspx如何播放 MP3: http : //msdn.microsoft.com/en-us/library/4y171b18.aspx
using System.Media;
String strTextYouWantAsMp3 = "Hello";
WebClient webClient = new WebClient();
webClient.DownloadFile("http://translate.google.com/translate_tts?tl=el&q=%22" + strTextYouWantAsMp3 + "%22", @"c:\audio.mp3");
SoundPlayer simpleSound = new SoundPlayer(@"c:\audio.mp3");
simpleSound.Play();
This link is now broken, you can refer to Chris Cirefice answer here: Google Text-To-Speech API此链接现已失效,您可以在此处参考 Chris Cirefice 的回答: Google Text-To-Speech API
As suggested you will need to make a get request against the following URL http://translate.google.com/translate_tts?tl=en&q=Hello%20World&client=t where q={your word you want to translate}
and tl={your language}
根据建议,您需要针对以下 URL 发出 get 请求http://translate.google.com/translate_tts?tl=en&q=Hello%20World&client=t where
q={your word you want to translate}
和tl={your language}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.