ricky0123 / vad

Voice activity detector (VAD) for the browser with a simple API
https://www.vad.ricky0123.com
Other
901 stars 143 forks source link

Handle very short speach to trigger onSpeechEnd #140

Closed vovaklh closed 1 month ago

vovaklh commented 1 month ago

Hi! I say very short word to microphone something like "Hi" and "Yes" and onSpeechStart callback is triggered. But then onSpeechEnd is not triggered and I continue sending data to backend. Is it possible that "onSpeechEnd" callback was triggered after very short word?

My preferences for VAD are next

const appVad = await vad.MicVAD.new({ // https://github.com/ricky0123/vad/blob/9afa42d73981a7d9d7c6aee6c6e75e79f16bb9b6/packages/_common/src/frame-processor.ts#L53 positiveSpeechThreshold: 0.8, minSpeechFrames: 5, // increasing this value force keeping started infinitely until fill the minSpeechFrames preSpeechPadFrames: 10, redemptionFrames: 1, // (0.3×16000)/1536 - increasing this value will make the VAD less sensitive // frameSamples: 1536, // the size of a frame in samples - 1536 by default submitUserSpeechOnPause: false, onSpeechStart: onSpeechStart, onSpeechEnd: onSpeechEnd, });

jfbourne commented 1 month ago

@vovaklh I want to do the same. How did you solve this?