/ tuesdaytooling

Tuesday Tooling: Nerd-Dictation

This week's fun Python tool comes courtesy of @FXBOY4EVA, and it is a cracker!

So What is it?

Nerd-Dictation, created by ideasman42 aka Campbell Barton, is a Linux based Python based dictation tool, a tool that listens for voice input and uses it to write text to the screen. This isn't a Siri, Alexa or Google Voice Assistant, rather it is a means to write text using our voice.


Hi reader!

I never put my blog posts behind paywalls, pop ups or include sneaky advertisements because quite frankly that is annoying and prevents anyone from accessing the content. I will always keep my blog content free of charge. But I do ask that if you are able and willing, that you buy me a "coffee" as it helps me to pay for hosting this blog, and to buy stuff to hack from Poundshops / Dollar Stores / Aliexpress which are used in free projects and reviews on this blog. It is You dear reader who make this possible, and I am immensely grateful for your support.

So How Do I Install It?

I installed Nerd-Dictation on my Ubuntu 21.04 machine.
Install the vosk offline open source speech recognition toolkit.

pip3 install vosk

Clone the Nerd-Dictation Github repository.

git clone https://github.com/ideasman42/nerd-dictation.git

Change directory to the Github repo.

cd nerd-dictation

Download a voice model as a ZIP archive, unzip the archive and then change the name of the directory to "model".

wget https://alphacephei.com/kaldi/models/vosk-model-small-en-us-0.15.zip
unzip vosk-model-small-en-us-0.15.zip
mv vosk-model-small-en-us-0.15 model

So How Do I Use It?

Video credt: YouTube covjeceideje42

Open a terminal and enter this command to start Nerd-Dictation using the model that we downloaded.

./nerd-dictation begin --vosk-model-dir=./model &

Open a text document and start speaking.
When you are done, go back to the terminal and type this to turn it off.

./nerd-dictation end

There are a few limitations, namely we cannot enter punctuation, nor delete any content. It simply listens and types, often guessing a few words incorrectly. But 70% of the time it gets it right.

Broken Pipe Error

On my Ubuntu 20.10 machine all was well, but on my news Ubuntu 21.04 machine I encountered a broken pipe error around the xdotool. It seems that this tool is not installed as standard. To install open a terminal and type.

sudo apt install xdotool

Happy Hacking