Add flush_flag to listener to flush the recorded audio immediately without waiting for the phrase to complete. #761
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add flush_flag to listener to flush the recorded audio immediately without waiting for the phrase to complete.
I am working on a real time speech to text application where I am kinda facing an issue.
When the user is done talking, the speech_recognizer waits until the pause_threshold is elapsed. This gets even worse in noisy environments with the dynamic_energy_threshold turned off.
My users don't want to wait as they know that they are done talking. They want to be able to hit enter and reduce the time taken to show them the transcription.
This is just one example of where this could be helpful. I'm sure this feature can be useful in many ways.
I have tried
stopper
but, it takes a maximum of a second to stop but wont flush the audio.Also, the stopper wont stop the recorder when the audio is being actively recorded at the times where
energy > energy_threshold
.Hence this change.
How to use?
Please feel free to modify the logic to make it more clean and robust.
TIA.
<|endoftext|>