Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public start() {
// this.setup();
this.mic = record.start({
threshold: 0,
verbose: this.config.verbose,
recordProgram: this.config.record.programme
});
this.mic.pipe(this.detector);
console.log('waiting for hotword');
}
const recordAudio = (file) => new Promise((resolve, reject) => {
const stream = fs.createWriteStream(file, { encoding: "binary" })
record.start({
// device: "",
channels: 2,
sampleRate: 44100,
silence: "0:05",
threshold: 0.01
// verbose: true
}).pipe(stream)
.on("error", (error) => reject(error))
.on("finish", () => resolve())
})
module.exports = function(){
record.start().pipe(request.post({
'url':'https://api.wit.ai/speech?client=chromium&lang=en-us&output=json',
'headers':{
'Accept' : 'application/vnd.wit.20161219+json',
'Authorization' : 'Bearer ' + config.wit.token,
'Content-Type' : 'audio/wav'
}
}, parseResult))
function parseResult(err, resp, body){
console.log(body)
}
}
models.add({
file: './resources/Brain.pmdl',
sensitivity: '0.5',
hotwords: 'brain'
})
const detector = new Detector({
resource: './resources/common.res',
models,
audioGain: 1.0
})
const hotword = thunkify.event(detector, 'hotword')
const hotword_recorder = record.start({
threshold: 0,
verbose: false
})
function * parseResult(body) {
try {
body = JSON.parse(body[0].body)
const query = body._text
if (query && query !== '' && !is_recognizing) {
is_recognizing = true
const response = yield api.get(query)
yield response_handler.handle(response)
is_recognizing = false
}
} catch (err) {
console.log(err)
public start() {
this.mic = record.start({
threshold: 0,
verbose: this.config.verbose,
recordProgram: this.config.record.programme
});
this.mic.pipe(this.detector);
console.log('waiting for hotword');
}
function initMic(){
return record.start({
sampleRateHertz: 16000,
threshold: 0,
verbose: false,
recordProgram: 'arecord',
silence: '10.0',
})
};
let writeFlag=0;
function initMic(){
return record.start({
sampleRateHertz: 16000,
threshold: 0,
verbose: false,
recordProgram: 'arecord',
silence: '10.0',
})
};
function initMic(){
return record.start({
sampleRateHertz: 16000,
threshold: 0,
verbose: false,
recordProgram: 'arecord',
})
};
ktkws.initialize('../data/kwsmodel.pack');
function initMic(){
return record.start({
sampleRateHertz: 16000,
threshold: 0,
verbose: false,
recordProgram: 'arecord',
})
};
ktkws.initialize('../data/kwsmodel.pack');
function initMic(){
return record.start({
sampleRateHertz: 16000,
threshold: 0,
verbose: false,
recordProgram: 'arecord',
})
};
ktkws.initialize('../data/kwsmodel.pack');