Trouble with speech recognition

Viewed 11
import speech_recognition as sr
sr.__verison__
'3.8.1'


AUDIO_FILE = path.join(os.path.join(path, "User/Desktop", "Module1.mp3")


r = sr.Recognizer()
with sr.AudioFile(AUDIO_FILE) as source:
    audio = r.record(source)  # read the entire audio file

# recognize speech using Sphinx
try:
    print("Sphinx thinks you said " + r.recognize_sphinx(audio))
except sr.UnknownValueError:
    print("Sphinx could not understand audio")
except sr.RequestError as e:
    print("Sphinx error; {0}".format(e))


File 'main.py', line 10
r = sr.Recognizer()
^ SyntaxError: invalid syntax

Hey everyone,

I'm pretty new to coding and I'm trying to make a simple program to take notes from an mp3 file. Anyone know whats wrong?

0 Answers
Related