Skip to content

Manohar-Gunturu/rs.speech.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 

Repository files navigation

rs.speech.js

Speech recognition and talk back using Javascript. rs.speech.js is written on top of Google SpeechRecognition and speechSynthesis. Check at https://jsfiddle.net/r6ftm7oq/ and https://jsfiddle.net/gunturumanohar/xsf3j64d/1/ .

CDN link https://cdn.jsdelivr.net/gh/Manohar-Gunturu/rs.speech.js@master/src/rs.speech.js

To Make Web Application speak

 
     speechRs.speechinit('Google UK English Female',function(e){
	        speechRs.speak("Heyy how its going", function() {
                   //speaking completed.
               }, false);	  
     });
   

The last boolean parameter of the speech function says whether to highlight the text on a dom element while reading it. Check the demos to understand the usage better.

To make your webapp listen

 
    speechRs.rec_start('en-IN',function(final_transcript,interim_transcript){
      console.log(final_transcript,interim_transcript);
    });   
    speechRs.on("I am fine",function(){	
      alert("user spoken I am fine");
    }); 

final_transcript is full transcript that captured from beginning of recording. interim_transcript is recent transcript that captured after the last break.

Don't run two .speak() at a time, instead use callback functions as shown below.

 
     speechRs.speechinit('Google UK English Female',function(e){
	  speechRs.speak("Heyy how its going", function() {
              speechRs.speak("This is after Heyy how its going",function(e) {	  
	      }, false); 
          }, false);	   
      });
   

Speech name and lang table:

Speech name lang
native (preferable) native
Google Deutsch de-DE
Google US English en-US
Google UK English Female en-GB
Google UK English Male en-GB
Google español es-ES
Google español de Estados Unidos es-US
Google français fr-FR
Google हिन्दी hi-IN
Google Bahasa Indonesia id-ID
Google italiano it-IT
Google 日本語 ja-JP
Google 한국의 ko-KR
Google Nederlands nl-NL
Google polski pl-PL
Google português do Brasil pt-BR
Google русский ru-RU
Google 普通话(中国大陆) zh-CN
Google 粤語(香港) zh-HK
Google 國語(臺灣) zh-TW

The MIT License (MIT) Copyright (c) 2016 Manohar Gunturu

About

Speech recognition and talk back using Javascript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors