nerdaxic / glados-voice-assistant

DIY Voice Assistant based on the GLaDOS character from Portal video game series. Works with home assistant!
https://www.henrirantanen.fi/2022/02/10/glados-voice-assistant-with-custom-text-to-speech/?utm_source=github.com&utm_medium=social&utm_campaign=post&utm_content=DIY+GLaDOS+Voice+Assistant+with+Python+and+Raspberry+Pi
Other
276 stars 23 forks source link

Alternative Mic Settings #23

Closed eternalliving closed 2 years ago

eternalliving commented 2 years ago

So, because I don't have a ReSpeaker and am just using a webcam microphone for input, I've had to alter a bit of code. I'm not sure if it's worth integrating into the code for others, but thought I would at least put my fix here. Maybe there is a better place for it?

in the glados.py file, simply specifying the device it needs to be listening to: audio_device='plughw:2,0' speech = LiveSpeech(audio_device='plughw:2,0', lm=False, keyphrase=glados_settings.settings["assistant"]["trigger_word"], kws_threshold=1e-20)

I wasn't sure how to specify which device with pulse, and so had to alter the sphinxbase init.py file to load alsa instead:

elif sys.platform.startswith('linux'):
    *** REMOVED TRY EXCEPT BLOCK WITH .ad_pulse ***
    from .ad_alsa import *

My only problem now is that it doesn't sense the keyword very well....or at all.... maybe recording volume problems. I'll have to play with pocketsphinx to see if I can get it to work better. I guess it's time I invest in a ReSpeaker!

eternalliving commented 2 years ago

Hmm... Nevermind... I obviously missed the option in the settings/yaml file :$ I also had disabled pulseaudio and needed to re-enable it. Everything is back to working just fine :)