Package: voca
Control your computer by voice!FeaturesDefine your own personal commands in your home directory (outside the Voca source tree).Different commands are available for each app, in addition to globally available commands.When editing a command file, your new commands are immediately available as soon as you save. No need to fiddle with reloading.If there’s a fatal error in a command file, don’t worry – Voca simply uses a backup from the last time that file worked.Your commands are executed asynchronously, so you never need to wait for one to finish before executing the next.Get immediate visual feedback during an utterance – Voca’seager modecan start acting on your commands as soon as the first word in your utterance. Switch tostrict modeand Voca will wait until the end of your utterance.Voca uses a modern parser, so your grammar can be arbitrarily complex.Use any speech engine you like – Voca takes its input as newline-separated json on stdin.Voca generates detailed structured logs you can use for debugging or analyzing your command history.Voca provides adapters for current Caster and Dragonfly commands, so you can keep using commands you like – just install Voca alongside Caster. More plugins and adapters for other systems can be added.Voca has a pluggable architecture. Install independent plugins for controlling your apps, without needing to fork the main repository.Voca uses Python 3.7+, so all the newest Python features are available.Voca is continuously tested in CI, and maintains test coverage checks.Free and open source, licensed GPLv3.LimitationsNobody has used it at all, so I don’t know if it’s useful.Voca does not provide a speech engine; it requires input from an existing one like Dragon, Kaldi, or DeepSpeech.Multiple platforms are planned, and the basic outline is there, but tests are not currently passing on OSX or Windows. Linux is working.The documentation is minimal.The Caster commands for specific programming languages aren’t yet implemented.There are several ways to define commands, but a single obvious way would be better.InstallationSome of Voca’s dependencies are not yet available on PyPI, so it can’t be installed directly with pip. In bash, run these commands:# Clone the repository.
git clone git@github.com:python-voca/voca.git
# Change working directory to inside the repository.
cd voca
# Create a virtual environment with Python 3.7.
virtualenv -p python3.7 venv
# Install the dependencies into the virtual environment.
venv/bin/pip install -r dev-requirements.txt -r requirements.txt
# Install Voca into the virtual environment.
venv/bin/pip install --no-deps -e .
# Activate the virtual environment to add its packages onto your PATH.
source venv/bin/activateUsageStart the server with Docker by running./run-kaldi-server.shor use another, such as the online servers athttp://voxhub.io/silvius. (Voca is not affiliated with Silvius, but is compatible.)Detect which audio device you’re using as the microphone by runningvoca--micwith different--devicenumbers until one of them shows output.Send audio to the server and receive transcripts on stdout by runningvoca--listen-d2, replacing2with your microphone’s device number from the previous step. Try saying something and check that you get json output. Cancel this process withcontrol-c.Check that the manager is working by sending it a transcript. The-ioption says which command module you want to load.voca manage -i voca.plugins.basic   <<EOF
{"status": 0, "segment": 0, "result": {"hypotheses": [{"transcript": "say bravo"}], "final": true}, "id": "eec37b79-f55e-4bf8-9afe-01f278902599"}
EOFIt should type the letterbon your screen. Cancel this process withcontrol-c.Start the listener and manager, piping the listener’s transcripts into the manager.voca listen -d <device_number>  | voca manage -i voca.plugins.basicSpeak into your microphonesay charlie. It should type the lettercon your screen. Cancel this process withcontrol-c.See the location of your config directory invoca--help, and add new commands in any.pyfile at{config_dir}/user_modules/*.py. Runvoca manage-iuser_modules.my_module(replacingmy_modulewith the name of your file, excluding the.pysuffix.)Try using the Caster commands.pip install --no-deps castervoice # Exclude Caster dependencies like wxpython.
voca listen -d <device_number>  | VOCA_PATCH_CASTER=1 voca manageFor example, in Visual Studio Code, saynew file. It should open new file in the editor by automatically pressingcontrol-n.Structured logs are stored in{config_dir}/logs/. Examine them witheliot-tree--color=always-l0{filepath} | less-SR. They’ll show how your commands flowed through the program, and will display the full grammar that was active during each command.DocumentationPrerequisites:A speech engine, e.g. kaldi/silvius server via included docker script or on its websiteMicrophonePython 3Developmentgit clone this repo and cd insideTo start the kaldi server and workers in docker, plus a client listening to your mic, run./run-kaldi-server.sh./pycli initwill create a virtualenv and install the package into it./venv/bin/voca manageto start the manager process which accepts commands on stdin. The manager will start its workers.To run the all tests run:toxNote, to combine the coverage data from all the tox environments run:Windowsset PYTEST_ADDOPTS=--cov-append
toxOtherPYTEST_ADDOPTS=--cov-append toxChangelog0.1.0 (2019-04-30)First release on PyPI.