Skip to content

Commit

Permalink
Merge pull request #82 from jbwincek/master
Browse files Browse the repository at this point in the history
Fixed: read suppresses errors on overflow
  • Loading branch information
Uberi committed Feb 17, 2016
2 parents 97b5b05 + 8768276 commit f86577d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions speech_recognition/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def listen(self, source, timeout = None):
if timeout and elapsed_time > timeout: # handle timeout if specified
raise WaitTimeoutError("listening timed out")

buffer = source.stream.read(source.CHUNK)
buffer = source.stream.read(source.CHUNK, exception_on_overflow = False)
if len(buffer) == 0: break # reached end of the stream
frames.append(buffer)
if len(frames) > non_speaking_buffer_count: # ensure we only keep the needed amount of non-speaking buffers
Expand All @@ -367,7 +367,7 @@ def listen(self, source, timeout = None):
while True:
elapsed_time += seconds_per_buffer

buffer = source.stream.read(source.CHUNK)
buffer = source.stream.read(source.CHUNK, exception_on_overflow = False)
if len(buffer) == 0: break # reached end of the stream
frames.append(buffer)
phrase_count += 1
Expand Down

0 comments on commit f86577d

Please sign in to comment.