speech.py
Allows your Windows python program to:
* get the text spoken by the user when prompted (a la raw_input())
* execute a callback when certain phrases are heard
* execute a callback when any understandable text is heard
* have different callbacks for different groups of phrases
* convert text to speech.
Example
Showing speaking out loud, a simple input, and listening for all
recognizable words.
::
import speech
import time
response = speech.input("Say something, please.")
speech.say("You said " + response)
def callback(phrase, listener):
if phrase == "goodbye":
listener.stoplistening()
speech.say(phrase)
listener = speech.listenforanything(callback)
while listener.islistening():
time.sleep(.5)
Requirements
Requires Windows XP or Vista, and Python 2.4 or 2.5. If you use
Windows Vista, you'll need to say "start listening" if Speech
Recognition is not awake.
In addition to easy_installing speech.py, you'll need pywin32
(for Python 2.5 <http://tinyurl.com/5ezco9>
__ or
for Python 2.4 <http://tinyurl.com/5uzpox>
); and if you're on XP,
you'll need the Microsoft Speech kit (installer
here <http://tinyurl.com/br8ysh>
).
Resources
Please let me know if you like or use this module - it would make
my day!