简体   繁体   中英

Best way to use Speech to text and Text to Speech in Chrome extensions?

I have found Text to Speech , but I also need Speech to text . Is there any way that Google offers it or an alternative to work with both?

Try SpeechToTextJs

which is a pure javascript solution I wrote, see the sample code below

 var speecht2text = new SpeechToText(function(){ speecht2text.setIsContinous(true); speecht2text.setAllowInterimResults(true); speecht2text.setMaxAlternatives(20); var lang = speecht2text.getAllSupportedLanguages(); speecht2text.setLanguage((lang[0]).key); // english speecht2text.start(); speecht2text.onEnd(function () { alert(speecht2text.getText()); }); setTimeout(function(){ speecht2text.stop(); },5000); },function () { alert("Browser Not Supported"); }); 
 <html> <head> <title></title> <script src="https://rawgit.com/imalhasaranga/SpeechToTextJs/master/dist/SpeechToTextJs.min.js"></script> </head> <body > </body> </html> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM