forked from sreuter/node-speakable
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
30 lines (24 loc) · 654 Bytes
/
example.js
File metadata and controls
30 lines (24 loc) · 654 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var Speakable = require('./');
var API_KEY = process.env.WKEY;
// Setup WIT.AI speech
var speakable = new Speakable({key: API_KEY});
speakable.on('speechStart', function() {
console.log('onSpeechStart');
});
speakable.on('speechStop', function() {
console.log('onSpeechStop');
speakable.recordVoice();
});
speakable.on('speechReady', function() {
console.log('onSpeechReady');
});
speakable.on('error', function(err) {
console.log('onError:');
console.log(err);
speakable.recordVoice();
});
speakable.on('speechResult', function(spokenWords) {
console.log('onSpeechResult:')
console.log(spokenWords);
});
speakable.recordVoice();