Skip to content

Instantly share code, notes, and snippets.

@alotaiba
Created February 3, 2012 07:31
Show Gist options
  • Save alotaiba/1728771 to your computer and use it in GitHub Desktop.
Save alotaiba/1728771 to your computer and use it in GitHub Desktop.
Google Text to Speech API

Google Text to Speech API

Base URL: http://translate.google.com/translate_tts
It converts written words into audio. It accepts GET requests.

GET

q
The query string to convert to audio

tl
Translation language, for example, ar for Arabic, or en-us for English

ie
Encoding format, use default UTF-8

Examples

This is an example for Arabic "السلام عليكم"

http://translate.google.com/translate_tts?ie=UTF-8&q=%D8%A7%D9%84%D8%B3%D9%84%D8%A7%D9%85%20%D8%B9%D9%84%D9%8A%D9%83%D9%85&tl=ar

This is an example for English "Hello World"

http://translate.google.com/translate_tts?ie=UTF-8&q=Hello%20World&tl=en-us
@acrolink
Copy link

The code with wget works fine. Does anyone know how to force male voice instead of female? Thank you.

@Nalinh
Copy link

Nalinh commented Mar 28, 2017

How to use this api for Vietnamese language ? Plz ! Tks

@Nalinh
Copy link

Nalinh commented Mar 28, 2017

@hungnmai
Copy link

Thanks @Smile4ever

@Bald-Badger
Copy link

It now returns a 503 ERROR

@cathhriss
Copy link

@hirahassanawan
Copy link

i got 404 error. Although I'm just using hardly 10 characters. still it is not working.

@naghamsayegh
Copy link

I'm trying to get text-speech into my react app ,I've found this example [https://codesandbox.io/s/1ggs6] ,it worked fine with chrome and edge,otherwise on Firefox it can't read more than 2 languages US-english ,I just want the german language.
Any idea on how to fix it ?

@TheVisionariesInk
Copy link

tl=en
If it is not lowercase it fails for me

@momokrunic
Copy link

I created a Python package for this purpose. You can find it here:
https://gitlab.com/labsoft-ai/google-translate-tts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment