tyiannak / pyAudioAnalysis

Python Audio Analysis Library: Feature Extraction, Classification, Segmentation and Applications
Apache License 2.0
5.75k stars 1.18k forks source link

Attribute Error in pyaudio #351

Closed aditya2522 closed 3 years ago

aditya2522 commented 3 years ago

I got this error plz help in solving this:- self.pyaudio_module = self.get_pyaudio() AttributeError: 'Microphone' object has no attribute 'get_pyaudio' here are the codes import pyttsx3 import datetime import tracestack import speech_recognition as sr

engine = pyttsx3.init('sapi5') voices = engine.getProperty('voices') engine.setProperty('Voices', voices[1].id)

def speak(audio): engine.say(audio) engine.runAndWait()

def wishMe(): hour = int(datetime.datetime.now().hour) if hour>=0 and hour<12: speak("Good Morning!")

elif hour>=12 and hour<18:
    speak("Good Afternoon!")

else:
    speak("Good Evening!")

speak("I am Jarvis Sir. Please tell me how may I help you")

def takeCommand(): r = sr.Recognizer() with sr.Microphone() as source: print("Listening...") r.pause_threshold = 1 audio = r.listen(source)

try:
    print("Recognizing...")
    query = r.recognize_google(audio, language="en-in")
    print(f"User said: {query}\n")

except Exception as e:
    print("say that again please...")
    return "None"
return query

if name == 'main': wishMe() takeCommand()