Open iak-a-dev opened 1 week ago
You can listen to onSpeechEnd and use audioData.length
directly to calculate the speech duration
_vadHandler.onSpeechEnd.listen((audioData) {
final duration = audioData.length / 16000; // Duration in seconds
if (duration < 3) triggerShortSpeechAction();
else if (duration < 6) triggerMediumSpeechAction();
else triggerLongSpeechAction();
});
This calculates duration from audioData
and triggers actions as defined by you.
@keyur2maru Your example involves determining the length of the received audio stream, and I need to determine the length of the pause.
My goal is to use the VAD to identify small pauses and based on them to cut the audio stream into pieces and thus start transcribing it before the speech is finished
In this case, you might be able to tweak redemptionFrames
in startListening; by default, it is set to 8 frames.
With framesSize, set to 1536 samples, 1 frame = 1536 samples = 96ms
For example, setting redemptionFrames
to 1 frame will finalize the speech segment after a pause of 96ms.
I need to understand if this package can be used for voice activity detection in my project, where I want to trigger different actions based on varying pause lengths. Is it possible to achieve this functionality with this package, and if so, how can I set up different actions for different pause durations?