works at Adobe
Apache Cordova core contributor
nutty about speech recognition
The future won't be like Star Trek.
P1: jeet?
P2: naw, jew?
P1: naw, t'rly t'eet bye.
P1: jeet?
P1: Did you eat?
P2: naw, jew?
P2: No, did you?
P1: naw, t'rly t'eet bye.
P1: No, it's too early to eat buddy.
Source: English language phoneme chart
[
{
"confidence": 0.97335243225098,
"transcript": "hello"
},
{
"confidence": 0.19940405040800,
"transcript": "hell low"
},
{
"confidence": 0.19910827091000,
"transcript": "how low"
}
]
OS | Application | SDK |
---|---|---|
Android | Google Now | Java API |
iOS | Siri | Many 3rd party Obj-C SDK's, SFSpeechRecognizer (iOS 10+) |
interface SpeechRecognition : EventTarget {
// recognition parameters
attribute SpeechGrammarList grammars;
attribute DOMString lang;
attribute boolean continuous;
attribute boolean interimResults;
attribute unsigned long maxAlternatives;
attribute DOMString serviceURI;
// methods to drive the speech interaction
void start();
void stop();
void abort();
};
attribute EventHandler onstart;
attribute EventHandler onaudiostart;
attribute EventHandler onsoundstart;
attribute EventHandler onspeechstart;
attribute EventHandler onspeechend;
attribute EventHandler onsoundend;
attribute EventHandler onaudioend;
attribute EventHandler onend;
attribute EventHandler onresult;
attribute EventHandler onnomatch;
attribute EventHandler onerror;
var recognition = new SpeechRecognition();
recognition.onresult = function(event) {
if (event.results.length > 0) {
var test1 = document.getElementById("test1");
test1.innerHTML = event.results[0][0].transcript;
}
};
recognition.start();
<a class="speechinput">
<img src="images/mic.png">
</a>
+
#speechinput input {
cursor:pointer;
margin:auto;
margin:15px;
color:transparent;
background-color:transparent;
border:5px;
width:15px;
-webkit-transform: scale(3.0, 3.0);
}
=
Speech
Bubbles
interface SpeechSynthesis {
readonly attribute boolean pending;
readonly attribute boolean speaking;
readonly attribute boolean paused;
void speak(SpeechSynthesisUtterance utterance);
void cancel();
void pause();
void resume();
SpeechSynthesisVoiceList getVoices();
};
interface SpeechSynthesisUtterance : EventTarget {
attribute DOMString text;
attribute DOMString lang;
attribute DOMString voiceURI;
attribute float volume;
attribute float rate;
attribute float pitch;
};
attribute EventHandler onstart;
attribute EventHandler onend;
attribute EventHandler onerror;
attribute EventHandler onpause;
attribute EventHandler onresume;
attribute EventHandler onmark;
attribute EventHandler onboundary;
<script src="//cdnjs.cloudflare.com/ajax/libs/annyang/2.5.0/annyang.min.js"/>
<script>
if (annyang) {
// Let's define a command.
var commands = {
'hello': function() { alert('Hello world!'); }
};
// Add our commands to annyang
annyang.addCommands(commands);
// Start listening.
annyang.start();
}
</script>
var commands = {
'show tps report': function() { alert('TPS Report!'); },
'turn the background color *color': function(color) {
document.body.style = 'background-color: ' + color;
},
'say hello (to the attendees) computer': sayHello
};
OS | Recognition | Synthesis |
---|---|---|
Android | ✓ | ✓ |
iOS* | ✓ | Native to iOS 7.0+ |
phonegap create speech com.example.speech speech
cd speech
phonegap platform add android
phonegap plugin add https://github.com/macdonst/SpeechRecognitionPlugin
phonegap plugin add https://github.com/macdonst/SpeechSynthesisPlugin
phonegap run android