@@ -35,9 +35,9 @@ export interface VADOptions {
3535
3636const defaultVADOptions : VADOptions = {
3737 minSpeechDuration : 50 ,
38- minSilenceDuration : 250 ,
38+ minSilenceDuration : 550 ,
3939 prefixPaddingDuration : 500 ,
40- maxBufferedSpeech : 60000 ,
40+ maxBufferedSpeech : 60000 , // 60 seconds
4141 activationThreshold : 0.5 ,
4242 sampleRate : 16000 ,
4343 forceCPU : true ,
@@ -227,7 +227,7 @@ export class VADStream extends baseStream {
227227
228228 // copy the inference window to the speech buffer
229229 const availableSpace = this . #speechBuffer. length - speechBufferIndex ;
230- const toCopyBuffer = Math . min ( this . #model . windowSizeSamples , availableSpace ) ;
230+ const toCopyBuffer = Math . min ( toCopyInt , availableSpace ) ;
231231 if ( toCopyBuffer > 0 ) {
232232 this . #speechBuffer. set ( inputFrame . data . subarray ( 0 , toCopyBuffer ) , speechBufferIndex ) ;
233233 speechBufferIndex += toCopyBuffer ;
@@ -250,9 +250,9 @@ export class VADStream extends baseStream {
250250 }
251251
252252 if ( pubSpeaking ) {
253- pubSpeechDuration += inferenceDuration ;
253+ pubSpeechDuration += windowDuration ;
254254 } else {
255- pubSilenceDuration += inferenceDuration ;
255+ pubSilenceDuration += windowDuration ;
256256 }
257257
258258 this . queue . put ( {
0 commit comments