This project aims at converting the recognized input that is speech from user and converting it into text .
Requirements:
1. Pyaudio (0.2.11)
2. Speech Recogniton(3.8.1)
Procedure:
Step 1 : Install Pyaudio 0.2.11
Open pycharm or any python ide and in its terminal enter the following command(Before doing this set the path for your python libraries and script in the environment variables of your system and download external python binaries for windows)
pip install PyAudio
After entering the following command in your terminal you will get an output which states that PyAudio has been installed.
Step 2 : Install SpeechRecognition 3.8.1
After installing Pyaudio enter the following command in your terminal :
pip install SpeechRecognition
Step 3 : Writing the code for speech conversion to text
Enter the following code in your python project file
code:
import speech_recognition as spr
c = spr.Recognizer()
with spr.Microphone() as source:
print("Please speak out :")
audio = c.listen(source)
try:
text = c.recognize_google(audio)
print("Your input was : {}".format(text))
except:
print("Sorry could not recognize what you said")
all the error before executing the above code.
Debug
RESULT : Speech to text conversion has been implemented using the SpeechRecognition Library in Python with the help of the above code that
helps us in taking the input from the source that is the user and after that converting it into text and displaying it as an output.
Submitted by Abhishek Joshi (ABS7781)
Download packets of source code on Coders Packet
Comments