Speech to text conversions have many applications in engineering field mostly for biomedical application and consumer electronics. When searching different libraries for achieving it we came across a suitable library for the purpose, which can be obtained from the following link.
The configuration and commands are tested in Ubuntu 14.04 and LinuxMint 17 versions. All the commands may be applicable to other versions of debian distributions.
The most common method to install the speech recognition library is to use pip.
For pip to work user should install setuptools for python by running the following in terminal
sudo apt-get install python-setuptools
Use the following command to install the required library using pip
sudo pip install SpeechRecognition
User may need to install the following library also, if not installed previously.
sudo apt-get install python-pyaudio
Use this sample code to test the application. The essential prerequisite is that the host system should be connected to the network.
Note: User may select the appropriate microphone in your system configuration if anything went wrong.
# Sample code for speech recognition # Uses google speech engine API # Network should be connected to the system import pyaudio import speech_recognition as sr index = pyaudio.PyAudio().get_device_count() - 1 print index r = sr.Recognizer() for i in range(5): with sr.Microphone() as source: audio = r.listen(source) try: print("You said " + r.recognize(audio)) except LookupError: print("Could not understand audio")
Readers please comment your experience in other speech recognition libraries also.