I made a repeating bot

I made a bot that repeats after you when it tells you to speak with your voice. Here is the modules and code
modules:

pip install gTTs
pip install SpeechRecognition
pip install --upgrade wheel
pip install playsound
pip install PyAudio

Code:

import speech_recognition as sr
def recognize(recognizer, microphone):
    with microphone as source:
        print("Speak")
        audio = recognizer.listen(source)
    try:
        print("...")
        text = recognizer.recognize_google(audio)
        return text
    except sr.RequestError:
        print("API unavalible")
    except sr.UnknownValueError:
        print('Not understandable')
    
recognizer = sr.Recognizer()
mic = sr.Microphone()

speech = recognize(recognizer, mic)
print("you said", speech)
2 Likes

I hope this was cool

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.