Updates
Rolling release / release (push) Failing after 1m24s

This commit is contained in:
2026-09-11 19:36:12 -04:00
parent 7604cded2c
commit a78708f8ff
26 changed files with 298 additions and 59 deletions
+3 -2
View File
@@ -25,6 +25,7 @@ export class VadSegmenter extends EventEmitter {
push(frame) {
const chunk = Buffer.from(frame || '');
const rms = pcmRms(chunk);
const durationMs = chunk.length / 2 / this.sampleRate * 1000;
const voiced = rms >= this.params.threshold / 10; // PCM RMS is 0..1; QVAC threshold is posterior-like.
this.emit('level', rms);
if (!this.speaking && voiced) {
@@ -33,8 +34,8 @@ export class VadSegmenter extends EventEmitter {
}
if (!this.speaking) return;
this.buffer.push(chunk);
if (voiced) { this.speechMs += this.frameMs; this.silenceMs = 0; }
else { this.silenceMs += this.frameMs; }
if (voiced) { this.speechMs += durationMs; this.silenceMs = 0; }
else { this.silenceMs += durationMs; }
if (this.speechMs >= this.params.maxSpeechDurationMs ||
(this.speechMs >= this.params.minSpeechDurationMs && this.silenceMs >= this.params.minSilenceDurationMs)) {
this.end();