snolte26 / Pluto

A Python voice assistant
GNU General Public License v3.0
1 stars 2 forks source link

More Linux support #22

Closed brandonland closed 3 years ago

brandonland commented 3 years ago

The following changes were made:

I moved the recognizer instance to outside of the function body (towards the top of the file). This is so that it only gets called once and doesn't keep creating a new object each time Jarvis listens. I added r.adjust_ambient_noise(source, 2) as well, which starts at the very beginning when you run python main.py, and runs only once. The recognizer will collect ambient audio for a couple of seconds. This is good in case you have a lot of ambient noise (my laptop's fan is normally obnoxious). The takeCommand function refers to this now outer-scoped recognizer instance rather than creating a new recognizer instance every time the function runs, which eliminates the need to constantly adjust for ambient noise each time Jarvis needs to listen (this was huge for me). It's like as if it just collects ambient audio once, then saves it for all future listenings, until you stop the script.

brandonland commented 3 years ago

Feel free to comment out the ambient audio thing if need be.. I can't get PyJARVIS to work without it, but I can just uncomment when I'm testing things.