Naomi
Naomi copied to clipboard
Friendlier initial configuration
It has always bothered me that when the user first types "./Jasper.py" it just errors out with a message that the configuration file does not exist. The documentation around creating a configuration file has always been awful, and successfully creating a configuration file at this point requires reading the code itself looking for options. There is a program called "populate.py'" in the jasper directory that starts the job of configuring jasper, but it is fairly useless being that it is missing a lot of options and doesn't produce an actual working configuration anyway.
I would like to alter the beginning of "application.py" to ask if you would like to create a configuration file, then alter "populate.py" to at least get you part of the way there.
This project also touches on issue 15 (if you select "pocketsphinx" as your engine, it should download and configure pocketsphinx automagically, if you select deepspeech as your engine, it should download and install deepspeech automagically), issue 16 (gmail password stored in plain text), and issue 57 (support for email services other than gmail).
I will not try to solve these issues in this fix, but will at least try to get it to the point where I can successfully use it to create a configuration file given that I already have pocketsphinx and festival installed. I am also doing a little cleanup in making the language selection the first question that appears so that (given that someone has gone through the trouble to write a translation file) the rest of the configuration can be done in the user's chosen tongue.
Eventually, the goal would be to get this all working in such a way that the configuration can be done primarily verbally, with the text interface only being a backup for when you need to enter a complex email password.
Options
Considering there are 3 options to get this job done:
1. Ask the user in application.py
if he want to create his profile (only if the profile doesn't exist) and if yes, switch to populate.py
2. Add an argument to the jasper execution ./jasper.py --profile
to create your profile using populate.py
too.
See the wiki and this file in the _main_(args=None)
function
3. Both 1. and 2. but 2 would be to recreate your profile if you missed/want to change something
Node-red User interface
I'm currently working on a User Interface with Node-red
The idea is to maintain your Naomi in your device from this interface only, meaning you'll be able to create, delete, and modify your profile from it (stt engine, tts engine, email adress, weather credentials ...), way more friendly-user than the current way
You'll also able to see properties of your devices (device cpu type, memory/cpu usages, uptime) system related informations ...
Once this UI will be mature enough, we'll be able to remove the program populate.py
, becoming obsolete and incomplete
Theses points are for the V1.0
I have a lot of ideas for the 2.0 ...
I'll push it there soon
Raspberry Pi images
When the UI is out with Naomi V2.2, i'll create a Raspberry Pi image with all the dependencies installed, pocketsphinx included, and with the user interface.
Users will just have to boot the raspberry pi with the burned micro sd card, go to the raspberry pi IP adress and setup their profile quickly and be able to use it, not more.
We need to add the ability to specify passive, active and special mode speech to text engines separately. Also, right now plugin settings are only picked up for SpeechHandler plugins, but need to be expanded to the other speechhandler types (audioengine, stt, tts, vad)
I am having a strange situation right now where somehow on my Buster install I have an incomplete profile.yml that is causing Naomi to crash with
CRITICAL:naomi.application:Audio device with slug 'None' not found
WARNING:naomi.application:Valid input devices: ph-usb-speaker-phone-audio
Traceback (most recent call last):
File "./Naomi.py", line 9, in <module>
naomi.main()
File "/home/pi/Naomi_git/naomi/__main__.py", line 173, in main
save_noise=p_args.save_noise
File "/home/pi/Naomi_git/naomi/application.py", line 225, in __init__
input_device = self.audio.get_device_by_slug(device_slug)
File "/home/pi/Naomi_git/plugins/audioengine/pyaudio-ae/pyaudioengine.py", line 87, in get_device_by_slug
"Audio device with slug '%s' not found" % slug)
naomi.audioengine.DeviceNotFound: Audio device with slug 'None' not found
so somehow I managed to create a profile without specifying an output device. I think this is because it saves a copy of the profile.yml immediately after setting the language at this point, so exiting the application after starting but not finishing populate.py (say you suddenly realize that you don't have a tts module installed) leads to this unstable situation. I think that adding a "settings" check to the main routine that kicks off populate.py if any of the basic fields (first_name, last_name, etc) before initializing the audio devices is the way to handle this.
Okay, I figured out what is causing the crash. Basically, each time I am running the pluginstore.detect_plugins() function, if there are any new plugins then I am saving that list to the profile. I can fix this by setting a profile arg for "save profile" set to false at the beginning of application.init() and then check it at the end (or at least after populate runs) to see if I need to save it. This is only a problem when the user kills populate before it finishes the first time.
I'll put that in my next pull request.
By the way, a while back I added some code for playing a test phrase if the user selected a flite voice. I'd love to see that expanded to all voices if anyone has time to work on that.
In the audio device setup, we start by choosing an output device. Then Naomi plays a tone to the device and asks if we can hear it. In my last few setups, both on Raspberry Pi and VirtualBox, I have had to adjust the output_chunksize parameter to at least 2048 to avoid buffer underrun errors. I'm going to change that to the default, and also the ability for the user to modify output_chunksize, output_padding, and output_pause while getting the beep to work in the validate_output_device() method.
The current installer is pretty user friendly -- certainly much more so than when we started. Things can always be improved, but the improvements should have their own issues.