I am using Ubuntu 20. I typed sudo nano /usr/share/alsa/alsa.conf
and got the following output: output of the above command
I don't know if there is something wrong with it, but whenever I try to run a speech recognition program in Python from Pycharm, I get the following errors:
errors while running the code
My code is as follows:
import wikipedia
import speech_recognition as sr
import tkinter.messagebox
n=0
window= tkinter.Tk()
while True:
r = sr.Recognizer()
with sr.Microphone() as source:
print('Speak Anything...')
audio = r.listen(source)
try:
text = r.recognize_google(audio,language= 'En', show_all=True)
if text=="Stop":
break
else:
window.geometry("700x600")
answer = wikipedia.summary(text)
label1 = window.Label(window, justify="LEFT",compound="CENTER",padx=10,text=answer, font='times 15 bold')
label1.pack()
window.after(50000, lambda: window.destroy())
window.mainloop()
finally:
answer = 'Sorry we cannot hear you.'
print(answer)