-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
36 lines (31 loc) · 980 Bytes
/
app.js
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
31
32
33
var stt = require('./BingStt/BingSpeechWebSocketAPIWrapper.js');
var uuid = require('uuid');
var events = require('events');
var fs = require('fs');
var socket = new stt('<YOUR KEY>',
{
format:'simple',
language:'en-US'
});
socket.on('connect',function(){
console.log('>>> connected');
//read a file
if(true){
var rs = fs.createReadStream('C:\\temp\\whatstheweatherlike.wav');
socket.startDetection(rs);
}else{
fs.readFile('C:\\temp\\whatstheweatherlike.wav', 'binary', function(err,data){
socket.recognize(data);
});
}
});
socket.on('data',function(data){
console.log('>>> data:' + (data));
});
socket.on('recognized',function(e){
console.log('==================================');
console.log(e);
console.log('==================================');
});
socket.open();
process.stdin.read();