Easy Speech Recognition


You can add speech recognition to Ubuntu with the Uberi Speech Recognition program on Github. The link is https://github.com/Uberi/speech_recognition. Clone the github to view the source and learn how to use this excellent program as a starting point for your own speech to text applications. Make sure your microphone is plugged in and working.

I make a directory called code off my home directory, cd there, and use that as my base.

cd ~
mkdir code
cd code

git clone https://github.com/Uberi/speech_recognition.git
You can compile this after installing all the dependencies or just do the procedure below to make it easy.

cd ~/code
git clone  https://git.assembla.com/portaudio.git
cd portaudio/
sudo apt install libasound-dev
sudo make install
cd ~/code
git clone  https://github.com/jleb/pyaudio.git
cd pyaudio/
python setup.py install
pip install --upgrade pyaudio
pip install SpeechRecognition
python -m speech_recognition

Now start talking!

BTW, an excellent project would be to convert open assistant to use this superior speech recognition. Open Assistant currently uses blather which doesn’t seem to work on Ubuntu. It should be an easy port. https://github.com/vavrek/Open-Assistant


dunder main has the code that is running this test. cd into speech_recognition and cat main. py.

Look for

# we need some special handling here to correctly print unicode characters to standard output
            if str is bytes:  # this version of Python uses bytes for strings (Python 2)
                print(u"You said {}".format(value).encode("utf-8"))

Add logic here to open applications, etc.


Notice that the flac codec is required. It is in the same directory as dunder main and dunder input.


pip 10 has a problem uninstalling distutil packages. If you run into that upgrading pyaudio, add --ignore-installed to the command.