forked from Uberi/speech_recognition
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some typos, update the FAQ, and change the behaviour of listen_in…
…_background (BACKWARDS INCOMPATIBLE - bumped major version).
- Loading branch information
Showing
3 changed files
with
81 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import speech_recognition as sr | ||
|
||
r = sr.Recognizer() | ||
m = sr.Microphone() | ||
|
||
print("A moment of silence, please...") | ||
with m as source: | ||
r.adjust_for_ambient_noise(source) | ||
print("Set minimum energy threshold to {}".format(r.energy_threshold)) | ||
while True: | ||
print("Say something!") | ||
audio = r.listen(source) | ||
print("Got it! Now to recognize it...") | ||
try: | ||
print("You said " + r.recognize(audio)) | ||
except LookupError: | ||
print("Oops! Didn't catch that") |