-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speech continuous #1940
Speech continuous #1940
Conversation
pip install pyaudio | ||
|
||
Example usage: | ||
python transcribe_streaming_indefinite.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indefinite
or infinite
?
|
||
|
||
def get_current_time(): | ||
return int(round(time.time() * 1000)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably don't need both int
and round
"""Opens a recording stream as a generator yielding the audio chunks.""" | ||
def __init__(self): | ||
self._rate = SAMPLE_RATE | ||
self._chunk_size = CHUNK_SIZE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: these should be passed into __init__
as arguments, possible defaulting to those global variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
self._bytes_per_chunk = (self._chunk_size * self._bytes_per_sample) | ||
self._chunks_per_second = ( | ||
self._bytes_per_second // self._bytes_per_chunk) | ||
self._untranscribed = collections.deque( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not very easy to trace through the code to understand how this second buffer self._untranscribed
is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, removed. Before it was holding over audio that might have failed, because it was waiting for the Error of streaming for too long, but updated to restart before that error making it's use redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good.
please explore ways of testing this.
) * Draft 1: indefinitely-long streaming transcription * Clean up & refactor of indefinite speech transcrib * Make sure chunks_per_second is a whole number. * Update for google-cloud-python client lib. * Update sample to not error out, but make a new request every ~60ish seconds * Update transcribe_streaming_mic.py * Clean up unnecessary code, since we no longer wait for it to error out * Update based on feedback
) * Draft 1: indefinitely-long streaming transcription * Clean up & refactor of indefinite speech transcrib * Make sure chunks_per_second is a whole number. * Update for google-cloud-python client lib. * Update sample to not error out, but make a new request every ~60ish seconds * Update transcribe_streaming_mic.py * Clean up unnecessary code, since we no longer wait for it to error out * Update based on feedback
* Draft 1: indefinitely-long streaming transcription * Clean up & refactor of indefinite speech transcrib * Make sure chunks_per_second is a whole number. * Update for google-cloud-python client lib. * Update sample to not error out, but make a new request every ~60ish seconds * Update transcribe_streaming_mic.py * Clean up unnecessary code, since we no longer wait for it to error out * Update based on feedback
* Draft 1: indefinitely-long streaming transcription * Clean up & refactor of indefinite speech transcrib * Make sure chunks_per_second is a whole number. * Update for google-cloud-python client lib. * Update sample to not error out, but make a new request every ~60ish seconds * Update transcribe_streaming_mic.py * Clean up unnecessary code, since we no longer wait for it to error out * Update based on feedback
* Draft 1: indefinitely-long streaming transcription * Clean up & refactor of indefinite speech transcrib * Make sure chunks_per_second is a whole number. * Update for google-cloud-python client lib. * Update sample to not error out, but make a new request every ~60ish seconds * Update transcribe_streaming_mic.py * Clean up unnecessary code, since we no longer wait for it to error out * Update based on feedback
) * Draft 1: indefinitely-long streaming transcription * Clean up & refactor of indefinite speech transcrib * Make sure chunks_per_second is a whole number. * Update for google-cloud-python client lib. * Update sample to not error out, but make a new request every ~60ish seconds * Update transcribe_streaming_mic.py * Clean up unnecessary code, since we no longer wait for it to error out * Update based on feedback
) * Draft 1: indefinitely-long streaming transcription * Clean up & refactor of indefinite speech transcrib * Make sure chunks_per_second is a whole number. * Update for google-cloud-python client lib. * Update sample to not error out, but make a new request every ~60ish seconds * Update transcribe_streaming_mic.py * Clean up unnecessary code, since we no longer wait for it to error out * Update based on feedback
) * Draft 1: indefinitely-long streaming transcription * Clean up & refactor of indefinite speech transcrib * Make sure chunks_per_second is a whole number. * Update for google-cloud-python client lib. * Update sample to not error out, but make a new request every ~60ish seconds * Update transcribe_streaming_mic.py * Clean up unnecessary code, since we no longer wait for it to error out * Update based on feedback
) * Draft 1: indefinitely-long streaming transcription * Clean up & refactor of indefinite speech transcrib * Make sure chunks_per_second is a whole number. * Update for google-cloud-python client lib. * Update sample to not error out, but make a new request every ~60ish seconds * Update transcribe_streaming_mic.py * Clean up unnecessary code, since we no longer wait for it to error out * Update based on feedback
No description provided.