Making a simple text 2 speech app in javascript…

Text 2 Speech demo app

Some time ago I found an app made inside a codepen that was featuring a simple text 2 speech app using the google translate apis. I wanted to make something nice for my girlfriend and found that utility really interesting. But, it was not working when I was trying to make it work as an standalone app (outside of the codepen site).

I don’t really know why but is seems that the services prevent the execution when the request is made from an app outside of the google translate domain. Don’t really know. But It was still working on the codepen page. So I come with some hack that actually made it work outside the codepen, and was able to surprise my girlfriend on our anniversary… but that’s not part of this story…

I recently remembered that I made that and put all the code together, cleaned it a bit and made a proper helper. Currently i have tested it on Chrome and Firefox. It is not working on IE11, I guess that some security policy is preventing my hack. I will maybe invest some time in the future to try to see why is that not working.

you can see it here: Text 2 Speech demo app

You can see the code by going here in jsFiddle or here in this gist