Add VAD and keyword spotting for the Node package with WebAssembly (#1286)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"sherpa-onnx-node": "^1.10.22"
|
||||
"sherpa-onnx-node": "^1.10.23"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ stream.acceptWaveform({samples: tailPadding, sampleRate: wave.sampleRate});
|
||||
|
||||
const detectedKeywords = [];
|
||||
while (kws.isReady(stream)) {
|
||||
kws.decode(stream);
|
||||
const keyword = kws.getResult(stream).keyword;
|
||||
if (keyword != '') {
|
||||
detectedKeywords.push(keyword);
|
||||
}
|
||||
kws.decode(stream);
|
||||
}
|
||||
let stop = Date.now();
|
||||
|
||||
|
||||
@@ -120,8 +120,8 @@ console.log('Done')
|
||||
const elapsed_seconds = (stop - start) / 1000;
|
||||
const duration = wave.samples.length / wave.sampleRate;
|
||||
const real_time_factor = elapsed_seconds / duration;
|
||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
||||
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||
console.log(
|
||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||
real_time_factor.toFixed(3))
|
||||
|
||||
Reference in New Issue
Block a user