getting no text output of what I speak when I run this program, it just shows: Listening...
I am not getting any errors, but the program don't give any voice to text output I don't understand what am I doing wrong, I have also installed pyaudio to connect my microphone so that's not the issue here, is it because I have not provided any delay if so then how can I do that?
import speech_recognition as sr
recognizer = sr.Recognizer() #created recognizer object
#using microphone as source
with sr.Microphone() as source:
print("Listening...")
# Adjust for ambient noise
recognizer.adjust_for_ambient_noise(source, duration=0.2)
# Capture the audio
audio = recognizer.listen(source)
#convert speech to text
try:
# Recognize the speech
text = recognizer.recognize_google(audio)
#using google speech recogonition api
print("You said:", text)
except:
print("Unable to recognize speech.")
I was expecting after some time when I speak, I may get a text output of what I spoke or and exception