Skip to content

Commit

Permalink
Merge pull request #2 from MhandsomeM/master
Browse files Browse the repository at this point in the history
fix: resolve "data" callback audio incorrect issue
  • Loading branch information
ThEditor authored Jul 8, 2024
2 parents 2b963fc + 7a0e6fe commit 2b47530
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/_common/src/real-time-vad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class RealTimeVAD extends EventEmitter {
} else if (this.inputType === "buffer") {
const buffer = Buffer.alloc(audio.length * 2)
for (let i = 0; i < audio.length; i++) {
buffer.writeInt16LE(Math.floor(audio[i] ?? 0 * 32767), i * 2)
buffer.writeInt16LE(Math.floor((audio[i] ?? 0) * 32767), i * 2)
}
return buffer
}
Expand Down

0 comments on commit 2b47530

Please sign in to comment.