A hands-free coding environment has a lot of moving parts, which can be overwhelming at first. This post will teach you how to set up the basic voice recognition environment. I also use eye tracking, but I’ll cover that in a separate post.
To begin with, install Dragon NaturallySpeaking, the voice recognition engine. Sadly, it’s only available for Windows, so you’ll have to do Linux development using a virtual machine or remote access (see my post for advice). I recommend Windows 7, because Dragon NaturallySpeaking still has a lot of bugs in Windows 8.1 (another post for that). I recommend Dragon 12 over 13. Dragon 13 only supports select-and-say in particular apps, which is a huge limitation. I used Dragon 13 for several months before downgrading thanks to readers’ advice in the comments, and I don’t miss a single feature. Any edition is fine; I use the premium edition.
I recommend investing in a good microphone; the usual recommendation is Sennheiser ME3. It’s not cheap ($200), but it matters a lot: Dragon is pretty frustrating, so you want to do everything you can to minimize that.
Next, install NatLink, an extension to Dragon that makes it possible to add custom Python commands. Follow the instructions here. If everything works, you’ll see a window pop up after starting Dragon titled “Messages from NatLink”. It’s common to run into problems installing NatLink, so read the instructions carefully. For your first installation, I highly recommend using their prepackaged version of Python to avoid trouble.
Finally, install Dragonfly, a cleaner Python interface to NatLink. The prepackaged binaries are several years out of date, so I recommend cloning their git repository. Run
python build_develop.py to install it. It’s just a Python library, so if it worked you should now be able to import dragonfly from Python.
To get started with Dragonfly, I recommend looking at some example modules. You can check out the original repository of examples or modules mentioned in the docs. For voice coding purposes, you’ll want to familiarize yourself with the multiedit module. Just drop a module into your NatLink MacroSystem directory, turn your microphone off and on, and NatLink will attempt to load it. If it’s not working, check the messages window to see if there are any error messages.
Of course, this is just the beginning. The interesting part is extending the Dragonfly modules and writing your own to support a full-featured voice coding environment. I’ll cover that in future posts!