This tutorial teaches you how to convert Text To Speech via Google API using Jquery and PHP.
The system sends a HTTP GET request to Google Speech URL that does the conversion of text to an MP3 audio file as an out put.
Below is a sample URL through which the request to Google is made.
http://translate.google.com/translate_tts?ie=UTF-8&q=The text to convert&tl=en&total=4&textlen=19
Explanation for the above URL is shown below:
(1) ie -> This is the encoding format used. The default as seen in the URL above is: UTF-8
(2) q -> This is the query string. URL encoding is a necessity for this field especially when the string contains special characters.
(3) tl -> This is the language to which the conversion will be done. This means the mp3 audio file will be read in this language. You can get the list of Google supported languages here https://developers.google.com/translate/v2/using_rest#language-params
(4) total -> This is the total of words to be converted.
(5) textlen -> This is the lenghth of text to be converted. The maximum is 100 characters.
This is a very simple to understand application as all you need to do are well explained in the script.
There is no special installation or configuration needed to use the system, all you need to do is to upload the files to your server or transfer the codes to your existing website and you are good to go.
The script is very easy to understand and customize with programming code comments to ease usability.
To see the system in action, please click on the demo button below and download the script if you like what you see.