Google text-to-speech in mp3 format

wget -q -U Mozilla -O output.mp3 "
EDIT: command updated to support accented characters! Works in any of 58 google supported languages (some sound like crap, english is the best IMO). You get a mp3 file containing your query in spoken language. There is a limit of 100 characters for the "q" parameter, so be careful. The "tl" parameter contains target language.

10 Alternatives + Submit Alt

What Others Think

Wow, I could spend all afternoon listening to my name in different European accents :-)
flatcap · 549 weeks and 6 days ago
I tried this with Vietnamese, which I enter using unicode on a text editor and paste into the command line. However, I get nonsense back in the mp3 file. My command: wget -q -U Mozilla -O output.mp3 " It plays fine in the browser, which converts the URL: However, when I paste this url in the command line, I still get giberish: wget -q -U Mozilla -O output.mp3 " Any suggestions?
vinhdizzo · 549 weeks and 6 days ago
I can't seem to get it to work, too. I guess it is an issue with wget? Maybe curl will work?
sairon · 549 weeks and 6 days ago
You could try piping the desired text into iconv to convert it to UTF-8 and only after that pipi the text into wget.
sairon · 549 weeks and 6 days ago
I tried piping to iconv: no go. curl also doesn't work.
vinhdizzo · 549 weeks and 6 days ago
it works great, i change it to function ### usage: texttospeach en hello+world texttospeach() { wget -q -U Mozilla -O output.mp3 " }
chmurli · 549 weeks and 6 days ago
We now can play the sound live without the need to save the mp3 file before with a bash function ( a bash builtin replace all spaces by the + caracter ) : say() { curl -s -A "Mozilla/5.0" "${@// /+}" | play -t mp3 -; } say "hello world"
sputnick · 547 weeks and 6 days ago
Note on the previous command : requires sox
sputnick · 547 weeks and 6 days ago
I've written a small ash shell script which can handle text flowing from a pipe and also gives you a warning when you exceed the 100-character limit.
sairon · 547 weeks and 6 days ago
I use wget with Google Translate to send sound to my Airport Express device:
bradyholt · 536 weeks and 2 days ago
Are there alternative voices? Like male / female?
jesuisbenjamin · 469 weeks and 1 day ago
AFAIK there are no alternative voices
sairon · 469 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: