Search code examples
pythonspeech-recognitionspeech-to-text

Python speech recognition is stuck (Mac)


This is my code:

import speech_recognition as sr

r = sr.Recognizer()

with sr.Microphone() as source:
    print("Go ahead!")
    audio = r.listen(source)

    try:
        text = r.recognize_google(audio)
        print("Understood: %s" % text)
    except:
        print("Couldnt recognize your voice")

But if I start the program it says Go ahead! but nothing else happens... Is it because I might have to gran python the microphone somehow? Im on Mac It doesn't print an error message or say Couldnt recognize your voice


Solution

  • The problem was using the integrated terminal. Using an external Terminal like iTerm or the default terminal app will solve the problem