In this lesson, we will learn how to use an open source speech recognition library.
PyAudio is a Python library for cross-platform audio I/O processing. SpeechRecognition is a speech recognition library. SpeechRecognition does not need to build a script to access the microphone and process audio files from scratch. It only takes a few minutes to automatically complete audio input, retrieval and operation.
14.1 Downloading and installing speech recognition library
1. Open the terminal software MobaXterm:
2. Log in to your Raspberry Pi (the way to log in to Raspberry Pi has been introduced in Lesson 1):
3. Enter the Course Code folder, this folder stores the sample code program to control the robot, enter the following command:
cd adeept_alter/02CourseCode/01ComponentCode
4. Enter the command to display the contents of the current directory:
ls
5. The 13Speech folder stores the sample code of this course. Enter the command to enter this folder:
cd 13Speech
6. Enter the command to display the contents of the current directory:
ls
7. Before running this program, we need to make some settings. You need to install the pyaudio library first, and enter the following commands in the command window:
sudo apt-get install -y swig portaudio19-dev python3-all-dev python3-pyaudio flac
8.After the download is complete, enter the following command to run the speech.py program:
sudo python3 speech.py