Skip to content
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

Merged
merged 13 commits into from
Jan 15, 2019
Merged

Speech continuous #1940

merged 13 commits into from
Jan 15, 2019

Conversation

nnegrey
Copy link
Contributor

@nnegrey nnegrey commented Dec 18, 2018

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 18, 2018
pip install pyaudio

Example usage:
python transcribe_streaming_indefinite.py
Copy link
Member

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))
Copy link
Member

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
Copy link
Member

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.

Copy link
Contributor Author

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(
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

@dizcology dizcology left a 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.

@nnegrey nnegrey merged commit 7bb425d into master Jan 15, 2019
@nnegrey nnegrey deleted the speech-continuous branch January 15, 2019 20:19
busunkim96 pushed a commit to busunkim96/python-speech that referenced this pull request Sep 1, 2020
)

* 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
busunkim96 pushed a commit to googleapis/python-speech that referenced this pull request Sep 3, 2020
)

* 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
telpirion pushed a commit that referenced this pull request Jan 13, 2023
* 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
dandhlee pushed a commit that referenced this pull request Feb 9, 2023
* 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
telpirion pushed a commit that referenced this pull request Mar 13, 2023
* 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
atulep pushed a commit to googleapis/google-cloud-python that referenced this pull request Apr 6, 2023
)

* 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
atulep pushed a commit to googleapis/google-cloud-python that referenced this pull request Apr 6, 2023
)

* 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
atulep pushed a commit to googleapis/google-cloud-python that referenced this pull request Apr 18, 2023
)

* 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
parthea pushed a commit to googleapis/google-cloud-python that referenced this pull request Oct 22, 2023
)

* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants