Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
286 views
in Technique[技术] by (71.8m points)

Speech Recognition in python not working in linux

I am using linux mint 20 and what error i am getting is that when i run the function for speech recognition the function starts but there is not output always in listening mode.

Here is my code:

import speech_recognition as sr
print('Checking if the speech_recognition is working properly or not.')
def takecom():
    r = sr.Recognizer()
    with sr.Microphone() as source:
        print("
Listning....")
        audio = r.listen(source)
    try:
        print("Recognising....")
        text = r.recognize_google(audio, language='en-in')
        print(text)
    except Exception:  # For Error handling
        print("Network connection error ????????")
        return "none"
    return text

takecom()
print('speech_recognition worked successfully')

SYSTEM DETAILS

Linux mint 20 64 bit

python 3.8.5

and a very strange thing is happening when i speak my words and then unplug the mic then it recognises my voice.

anyone please help me.

question from:https://stackoverflow.com/questions/66062468/speech-recognition-in-python-not-working-in-linux

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...