alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.37k stars 1.04k forks source link

add SetPause (replacing SetEpMode) #1457

Closed johngebbie closed 7 months ago

johngebbie commented 8 months ago

This adds a SetSilence function with a float argument to set the min_trailing_silence values. It's simpler yet more useful than SetEpMode, which is limited to an enum of only DEFAULT/SHORT/LONG. Also, there seemed to be a bug in that calling SetEpMode repeatedly would keep scaling the values further.

I based the rule{2,3,4} constants off the values from the small-en-us model.

SetSilence lets me, for example, set the min_trailing_silence values to 0.0 for very responsive results for gaming (video).

Closes: https://github.com/alphacep/vosk-api/issues/1348

Thank you!

nshmyrev commented 8 months ago

Hi! Thanks a lot for the patch. I'm a bit concerned about naming, let me comment in the code

nshmyrev commented 7 months ago

I think we can have both ep mode (which are easier to understand for my opinion) and exact float value in the API. Let me work it out.

nshmyrev commented 7 months ago

I've implemented it, see the issue.

johngebbie commented 7 months ago

Amazing, thank you!