0

I have this code running in Replit:

import speech_recognition as sr
import pyaudio

# create an instance of the Recognizer class
r = sr.Recognizer()

# use the microphone as the source for audio input
with sr.Microphone() as source:
    # record a short phrase
    print("Say something!")
    audio = r.listen(source)

# recognize speech using Google Speech Recognition
try:
    print("Google Speech Recognition thinks you said " + r.recognize_google(audio))
except sr.UnknownValueError:
    print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
    print("Could not request results from Google Speech Recognition service; {0}".format(e))

But I keep getting an error that says

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import pyaudio
ModuleNotFoundError: No module named 'pyaudio'

What do I do?

I tried going online and figuring out how to install PyAudio, but nothing is working for me. I thought that by now my code should have started doing something. It won't do anything though because of the error. I might need to download Python to my Windows computer, but I am hoping that is unecessary, since this is my parents computer that I get to borrow.

0 Answers0