Voice Activity Detection (VAD)
This article introduces the Voice Activity Detection (VAD) feature in JS SDK.
To activate VAD, initialize Krisp SDK with the VAD model and provide configuration parameters. To retrieve the result, register for VAD callbacks. This will ensure efficient CPU usage by sending results only upon state changes.
To activate the VAD feature, follow the following steps:
- [Init] pass VAD model to Krisp SDK
krispSDK = new KrispSDK({
params: {
..., //other params
models: {
model32: '/dist/models/model_32.kw',
...,
**modelVAD: '/dist/models/model_vad.kw',**
}
}
});
await krispSDK.init();- [CreateNoiseFilter] provide VAD options when creating a noise filter
const params ={
...., //other params
useVAD: true;
vad: {
threshold: 0.5,
}
}
filterNode = await krispSDK.createNoiseFilter(params,...);useVAD: enable flag
options:
threshold: - VAD threshold value
- [Result] to read VAD result vad_callback needs to be registered
filterNode.addEventListener('vad_callback', (e) => {
console.log("VAD_RESULT is", e.data.data);
});❗Note that we only send the result to the user when the state changes, as sending the result for each frame is CPU-intensive.
Updated about 20 hours ago
