Text to Speech in Hype


(Greg) #1

This is interesting…

HTML5 has text to speech & speech recognition options. Here’s the javascript code. for Text 2 Speech…

 var x = hypeDocument.getElementById('text').innerHTML;
 var u = new SpeechSynthesisUtterance();
 u.text =  x;
 u.lang = 'en-US';
 u.rate = .8;
 speechSynthesis.speak(u);

edited: with a voice selection…

 var x = hypeDocument.getElementById('text').innerHTML;
 var u = new SpeechSynthesisUtterance();
 var voices = speechSynthesis.getVoices();
 u.voice = voices.filter(function(voice) { return voice.name == 'Trinoids'; })[0];
 u.text =  x;
 u.lang = 'en-US';
 u.rate = .8;
 speechSynthesis.speak(u); 

speaks.hype.zip (15.5 KB)

It needs some work but it has potential — (very limited browser support tho - just Safari, Chrome and partial in iOS)


(strmiska) #2

super! thanx - the voice is funny :wink:


#3

http://blog.monotonous.org/2015/04/14/reintroducing-espeak-js/ looks pretty powerful.


(Andrew) #4

Looks good, especially the voices. But i think the next real event is Speech to Text to become more widely supported. That is what i am waiting for. Not found any library that will do this on all browsers yet :frowning: