Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
albho committed Feb 2, 2024
1 parent df4ad02 commit 519733a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions demo/nodejs/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ function fileDemo() {

let frames = getInt16Frames(inputWaveFile, engineInstance.frameLength);

const printedNums = new Set();
const printedNumbers = new Set();
for (let i = 0; i < frames.length; i++) {
const result = engineInstance.process(frames[i]);
const timestamp = (
(i * engineInstance.frameLength) /
engineInstance.sampleRate
).toFixed(1);

if (result >= threshold && !printedNums.has(timestamp)) {
if (result >= threshold && !printedNumbers.has(timestamp)) {
console.log(`Detected voice activity at ${timestamp} sec`);
printedNums.add(timestamp);
printedNumbers.add(timestamp);
}
}

Expand Down

0 comments on commit 519733a

Please sign in to comment.