i need play google text-to-speech in javascript.
idea use web service:
http://translate.google.com/translate_tts?tl=en&q=this%20is%20just%20a%20test
and play on certian action, e.g. button click.
but seems not loading normal wav/mp3 file:
<audio id="audiotag1" src="audio/example.wav" preload="auto"></audio> <script type="text/javascript"> function play() { document.getelementbyid('audiotag1').play(); } </script>
how can this?
another option may html5 text speech, in chrome 33+ , many others.
here sample:
var msg = new speechsynthesisutterance('hello world'); window.speechsynthesis.speak(msg);
with this, perhaps not need use web service @ all.
Comments
Post a Comment