jamsch / expo-speech-recognition

Speech Recognition for React Native Expo projects
MIT License
124 stars 11 forks source link

Add option to customize continuous silence/next sentence time? #45

Open elongstreet88 opened 1 month ago

elongstreet88 commented 1 month ago

From the README:

...
// [Default: false] Continuous recognition.
  // If false:
  //    - on iOS 17-, recognition will run until no speech is detected for 3 seconds.
  //    - on iOS 18+ and Android, recognition will run until a final result is received.
  // Not supported on Android 12 and below.
  continuous: true,
...

Would it be possible to variabilze this into milliseconds, so that it could be set? In some tests, I've found that fast speakers that don't pause very much during speech cause a very long sentence to be synthesized and/or it the results event isn't fired for a long time.

It would be helpful to be able to either statically set a max results time (like 10 seconds) and also set the max silence between next sentence time.

jamsch commented 1 month ago

Hi @elongstreet88

Yep, that's on the cards to implement however I'm on the fence whether this should also modify the Android-equivalent timers (which they don't recommend you change). Right now I'm intending to implement two options for timer configs:

I'll also have to research what defaults these are at least on Android com.google.android.tts / com.google.android.as so that it behaves similar on iOS, but I don't think this is documented anywhere so it'll have to be a guess.