Python-AI-Virtual-Assistant icon indicating copy to clipboard operation
Python-AI-Virtual-Assistant copied to clipboard

Crashes after startup dialog

Open Breedbloksem opened this issue 4 years ago • 4 comments

When i open it it just closes right after saying: "how may i help you?" Any fixes?

Breedbloksem avatar Oct 09 '21 16:10 Breedbloksem

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.

Akul2010 avatar Nov 07 '21 19:11 Akul2010

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.

ghost avatar Mar 13 '22 04:03 ghost

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 avatar Jun 17 '22 00:06 bilzeebubb

@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.

ghost avatar Jun 17 '22 01:06 ghost