简体   繁体   English

如何从谷歌翻译下载文本到语音数据?

[英]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.

相关问题 从Google翻译下载 - Download From Google Translate 如何在Windows窗体中使用Google文本语音API? - How can I use google text to speech api in windows form? 如何从服务器下载文本? - How can I download text from server? 如何在部署的 WPF 应用程序中使用谷歌语音向 api 密钥发送文本? - How can I use a google speech to text api key in deployed WPF app? 如何为Microsoft Bot框架向文本数据添加实时语音(正是Google Speech所做的) - How to add live speech to text data for microsoft bot framework(exactly what google speech does) 如何在应用程序中中断从文本到语音合成的播放? - How can I interrupt playing of text to speech synthesis in my application? 如何将Google协议缓冲区转换为普通对象 - How can I translate Google Protocol Buffers to plain objects 如何在不设置环境变量的情况下将谷歌语音的凭据设置为文本? - How do I set credentials for google speech to text without setting environment variable? 如何在PC上下载语言包以使用离线Google翻译? - How to download language packs on PC in order to use offline Google Translate? 我正在尝试使用Google Translate翻译文本文件数组,但它不会翻译,如果我翻译一个文件的话 - I'm trying to translate array of text file using google translate but it doesn't translate, if i translate one file it does
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM