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.
Description
When testing today I discovered that using the google stt plugin
no audio was being transcribed due to the fact that that plugin
does not seek a location in the passed file handle, which the
pocketsphinx and deepspeech plugins I tested against before do.
Since it is not a requirement that stt plugins set the file
location, and it is reasonable to assume that the file handle is
currently pointed to the beginning of the file, it seemed
reasonable to fix this in the naomi/mic.py module.
This patch just sets the file pointer back to the beginning of
the file before calling active_stt_engine.transcribe() on the
active file handle when using passive_listen mode.
Related Issue
Issue #48 - Passive Listening for commands
Motivation and Context
In passive listen mode, the passive listener is used to check the audio for the keyword. If the keyword is found, then the same block of audio is passed directly to the active listener. The active listener might, rightly, assume that the file handle should be pointed to the beginning of a file that was just opened. When the file handle is still set to the end of the file, then it appears to the plugin as if the file itself is empty, resulting in an empty transcription.
How Has This Been Tested?
Tested using pocketsphinx for passive listening and google stt plugin for active listening.
Types of changes
Checklist: