Tim -
Specifically, I have Windows Vista on my laptop. All by itself, the
Windows speech recognition engine (under Control Panel | Speech
Recognition) takes you through a tutorial, trains the system to
understand your voice and then gives you the ability to open and
control applications as well as dictate into a text editor.
To create the specialized voice macros used to write the Hello World
program in the Python No Hands video, I downloaded Python 2.5 from
http://www.python.org/ and dragonfly from
http://code.google.com/p/dragonfly/
and then modified the _multiedit.py program from
http://dragonfly-modules.googlecode.com/svn/trunk/command-modules/documentation/mod-_multiedit.html
to include my customized voice commands:
"insert comment": Text("# \n# \n# \n# \n# \n# \n# \n# \n# \n")+Key("up:5, end"),
"insert function": Text("def ():\n\t\"\"")+Key("up, left:2"),
"insert class": Text("class ():\n\t\"\"")+Key("up"),
"doc add": Key("c-end, enter:2, backspace"),
"with": Text("()")+ Key("left"),
"quote": Text("\"\"")+ Key("left"),
Finally, WHILE running _multiedit.py under Python 2.5, I opened a
second IDLE window and used the speech recognition engine to drive the
keystrokes.
This past weekend at the Kiwi PyCon conference, I moved to the next
step: getting the computer to TALK BACK and await further voice input.
Here is the code I used to do that:
# A voice mirror
# (c) Copyright 2009 by John Graves
# using dragonfly by Christo Butcher
# Licensed under the LGPL, see <
http://www.gnu.org/licenses/>
import pkg_resources
import dragonfly
from dragonfly import *
e = dragonfly.get_engine()
e.speak("Hello")
grammar = Grammar("voice mirror")
class SpeakRule(CompoundRule):
spec = "<text>"
extras = [Dictation("text")]
def _process_recognition(self, node, extras):
e = dragonfly.get_engine()
e.speak("You said %s!" % " ".join(node.words()))
e.speak("Say something more intelligent.")
grammar.add_rule(SpeakRule()) # Add the top-level rule.
grammar.load() # Load the grammar.
BUT -- before you even start on following along -- please give a
thought to the potential of our working together to make this
technology really helpful and useful. As you say Tim, you have a
blind friend. I know a guy who fell down some stairs, broke his neck
and lost the use of his hands and feet. Voice-based interfaces would
be extremely helpful to these folks, but I think everyone else could
benefit as well. Think of the 1+ billion cell phones being sold every
year and what it would mean if there were really useful
phone-and-find-out services. I'm just starting work on a PhD on the
open source development of these voice-enabled interfaces so it is my
full-time job now to coordinate and study a project in this area.
Please let me know if you'd like to be involved -- whether as a
developer or just a tester. Thanks in advance and enjoy talking!
Cheers,
John Graves