I was looking for some text to speech service to get good mp3 file for some text in my project and I found couple of paid services which are really great but having this as part time project I wouldn’t pay. So I kept looking and I found that Google provide text to speech service. just use the following url and pass the text as q parameter and url generate MP3 output which you can store and use it. http://translate.google.com/translate_tts?ie=utf-8&tl=en&q={text} There are also some PHP wrapper classes available which uitlize same service.
check out these links for more info
http://www.masnun.com/2009/12/14/googles-text-to-speech-api-a-php-wrapper-class.html
http://ctrlq.org/code/19147-text-to-speech-php
using javascript, you can also use audio class to play mp3 from web url like as follow.
var audio = new Audio(); audio.src ='http://translate.google.com/translate_tts?ie=utf-8&tl=en&q=Hello%20World'; audio.play();