How can we extend the speech recognition listening time in React-Native-voice to accommodate users who need more time to think before verbalizing their thoughts, preventing premature stopping of speech recognition when they pause but haven't completed their intended message?
React-Native-voice for speech recognition, how can users be provided with additional pause time?
690 Views Asked by Tao At
1
There are 1 best solutions below
Related Questions in REACT-NATIVE
- Facebook Api - Albums/Photos/Comments
- How to get Facebook subscriber count + friend count
- Firebase facebook authentication not working
- Facebook iOS SDK 4 error info.plist
- Why don't any of my facebook share buttons work?
- Can't perform authentication through facebook with Parse
- PlayN and Firefox issues
- How do I stop the facebook send widget from going off the screen?
- Add extended permissions - Facebook
- Pass image, summary, URL to Facebook share button in ASP.NET MVC
Related Questions in SPEECH-RECOGNITION
- Facebook Api - Albums/Photos/Comments
- How to get Facebook subscriber count + friend count
- Firebase facebook authentication not working
- Facebook iOS SDK 4 error info.plist
- Why don't any of my facebook share buttons work?
- Can't perform authentication through facebook with Parse
- PlayN and Firefox issues
- How do I stop the facebook send widget from going off the screen?
- Add extended permissions - Facebook
- Pass image, summary, URL to Facebook share button in ASP.NET MVC
Related Questions in REACT-NATIVE-VOICE
- Facebook Api - Albums/Photos/Comments
- How to get Facebook subscriber count + friend count
- Firebase facebook authentication not working
- Facebook iOS SDK 4 error info.plist
- Why don't any of my facebook share buttons work?
- Can't perform authentication through facebook with Parse
- PlayN and Firefox issues
- How do I stop the facebook send widget from going off the screen?
- Add extended permissions - Facebook
- Pass image, summary, URL to Facebook share button in ASP.NET MVC
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If your app is on the Android platform, you can adjust the following constant:
EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS
to increase the time it takes for the recognizer to consider the input complete and end the recognition session after stopping hearing speech RecognizerIntent.To make this change in React Native (RN), follow these steps:
Locate the file
react-native-voice/src/index.js
.In this file, find the following code snippet:
} else { Voice.startSpeech(locale, callback); }
In the
Object.assign()
function, you can add the parameter ofEXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS
and set the value to the desired time in milliseconds. For example, if you want to set it to 5000 milliseconds, the updated code would look like this:EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS: 5000,
By making this adjustment, you can control how long the speech recognition should wait for silence before considering the input complete, allowing users more time to pause and think before ending the recognition session.
While attempting to extend the listening duration for speech recognition, you may encounter an issue where the app continues to listen for an additional 5 seconds after silence but eventually crashes. If this problem occurs, you may notice that the
_onSpeechResults()
function returns a null matches object, resulting in a null speech result, which is likely the cause of the app crash:Interestingly, even with the null matches in
_onSpeechResults()
, the_onSpeechPartialResults()
function still receives multiple messages containing partial results.For example, the following is a screenshot of the results captured in the
In the
_onSpeechPartialResults
, we can see that the end of speaking has been reached, even if the response from the_onSpeechResults
is null. Also, I noticed that the most complete chunk of the speech is always after theonSpeechEnd
event. Therefore, instead of relying solely on the null result provided byonSpeechResults
, we can now gather and join all the collected chunks of partial results received after eachonSpeechEnd
event.Therefore, as shown below, I wrapped the
onSpeechResults()
function in a null check, and concatenated partial results from_onSpeechPartialResults
together in a list to form a more complete transcript of the speech, ensuring that the final result is more accurate and reliable.