I found this code from the Internet and it uses the Google translate's text to speech capability using URL. here is the code:
Google's free service instantly translates words, phrases, and web pages between English and over 100 other languages. Google Voice gives you one number for all your phones, voicemail as easy as email, free US long distance, low rates on international calls, and many calling features like transcripts, call.
I know how to call this in my vb.net but I don't know how to save the MP3 file from Google Translate. i used the system.speech in vb.net to have this capability but I specifically need to get the speech from google translate. so, does anyone know how to save the sound file from Google Translate using that URL? Thanks.
user1169690user1169690
6 Answers
EDIT 2015-12-26
As of 2015-12-21 this code no longer works following further changes to the Google TTS API. As indicated by @ncpierson a new additional parameter
tk
is required, and I am having a hard time working out how to calculate it in a shell script. I will revise this answer with a new edit as/when I can.I'm not sure about Windows, but in Linux this is very easy from the command line. I use a command line script to download English audio of text strings:
I do the same thing with Chinese (the script is a bit simpler because there are no spaces to parse between words):
Most Linux distros include wget as standard, but it can easily be downloaded (see, e.g, this link).
(Thanks to @ncpierson for
client=t
parameter).BobbleBobble
The script that the google translate page ran, when I used your example, produced a filecalled 'translate_tts' with no file extension.
One easy way to use this file is to tell your browser, e.g. Mozilla [under the 'TOOLS'/'OPTIONS'/APPLICATIONS], to save audio files - in this case I believe it is an MP3,even though there is no extension. In any case, select the option under 'ACTION' next to audio/wave or audio/Mpg to 'SAVE FILE'.
When the browser loads your URL, it downloads the file called 'translate_tts',no matter what the data is. So, in your case I would change the file name to'Hello-World.mp3'. That way you now have the file on your hard drive, containing the audio you want, which can be played by any audio player, preferably VLC media player since it will play almost any format.
Of course if you want a different audio , e.g. 'Goodbye-World', you just change your URLto
http://translate.google.com/translate_tts?tl=en&q='Goodbye-World'
and repeat the above steps to save the file as 'Goodbye-World.mp3'.
JCCbamaJCCbama
If you want to do it manually, right click 'save as...' will do the trick. Example: test your own example.
![Google Google](/uploads/1/2/4/9/124912887/842911493.jpg)
I have no idea of vb.net, but I am going to try to download several bits of information through bash script in linux. I was going to recommend using wget until I saw the vb.net tag. Check this thread, it might give you some idea. You basically want to download the page of the link, which is an mp3.
Francisco PresenciaFrancisco Presencia
Here's a solution written in Java:
Exception handling omitted. IOUtils comes from Apache Commons IO.
HunternifHunternif
I was was trying to write a function that does exactly what yours does, plus a little extra, and after some searching I was able to produce the following code. It does four things:
- Does a web request to get the MP3 file from google TTS
- Saves the MP3 to a file (I put it 1 layer deeper into the running directory)
- Plays the file using the windows media player COM API (can be included as a COM reference in your project)
- Stores a history of previously uttered phrases so it doesn't have to hit the API again when a repeated phrase appears (the internet isn't great where I plan on installing this).
JrudJrud
I have produced a semi-automated way to acquire the generated speech files in 2017 and strip all of Google's metadata. It's for Firefox and it's written in C#. So it's close to what you're trying to do, but still not 100%. I tried to obtain the files directly, but Google has implemented some pretty fancy security features that I couldn't seem to get around at this time. When I thought I got close, it sent me back a ReCaptcha.
I've open sourced it here: https://github.com/Goodlookinguy/FFMediaCacheGrabber and provided a how-to video as well.
Not gonna lie, I don't feel great about this answer as it's not what you're looking for, but it's all I could do at least for now to help people.
Nicholas R. GrantNicholas R. Grant
protected by Community♦Mar 16 '13 at 22:20
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Would you like to answer one of these unanswered questions instead?