Skip to content

Commit

Permalink
Add WavFile.FRAME_COUNT and WavFile.DURATION
Browse files Browse the repository at this point in the history
  • Loading branch information
kamushadenes committed Jun 2, 2015
1 parent 40f7517 commit 376a85b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions speech_recognition/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def samples_to_flac(self, source, frame_data):

def record(self, source, duration = None, offset = None):
"""
Records up to ``duration`` seconds of audio from ``source`` (an ``AudioSource`` instance) into an ``AudioData`` instance, which it returns.
Records up to ``duration`` seconds of audio from ``source`` (an ``AudioSource`` instance) starting at ``offset`` (if specified) into an ``AudioData`` instance, which it returns.
If ``duration`` is not specified, then it will record until there is no more audio input.
"""
Expand Down Expand Up @@ -331,9 +331,8 @@ def recognize(self, audio_data, show_all = False):
break

# make sure we have a list of transcriptions
#if "alternative" not in actual_result:
# raise LookupError("Speech is unintelligible")
print(actual_result)
if "alternative" not in actual_result:
raise LookupError("Speech is unintelligible")

# return the best guess unless told to do otherwise
if not show_all:
Expand Down

0 comments on commit 376a85b

Please sign in to comment.