Python-AI-Virtual-Assistant
Python-AI-Virtual-Assistant copied to clipboard
Crashes after startup dialog
When i open it it just closes right after saying: "how may i help you?" Any fixes?
probably speech_recognition module is giving problems
this happened to me to, pyaudio module wasn't working
I fixed it with the following commands:
pip3 install pipwin pipwin install pyaudio
it should work now.
Just install PyAudio module or specify the microphone you're using in the code by putting the index like 0,1,2 etc. To install PyAudio, follow these steps in either of powershell or command prompt :`
- Step 1 :
pip install pipwin - Step 2 :
pipwin install pyaudio
And you'd be good to go.
If still any issues persist, you'd have to check whether or not your device drivers are up to date. Hope this answer would help you.
how do you specify the microphone? i have been having an issue where the speak function will run everything normally until it gets to the if statements, then it wont read the text out loud, only print it.
@bilzeebubb
If you look through the code, you would find a function called 'takecommand' whose code is : `def take_command():
try:
with sr.Microphone() as source:
print('listening...')
voice = listener.listen(source)
command = listener.recognize_google(voice)
command = command.lower()
if 'alexa' in command:
command = command.replace('alexa', '')
print(command)`
Over here, look at the line which says :
with sr.Microphone() as source:
You can specify the index of the microphone in the brackets.
Hope it helped you, you can leave a comment if it raised any errors.