Rhasspy offline voice assistant toolkit

Looks like our posts just crossed - will take a look at your suggestions when a few more of my brain cells are working properly.
Thanks for trying to make this work for me.

I wonder if you were to replace the contents of /usr/share/alsa/alsa.conf with something like what I had pasted earlier for .asoundrc if it would let you do the microphone/speakers on different devices.

BTW, you can avoid having to modify any files inside the docker container by adding another -v to your docker run. Something like docker run ... -v /full/path/to/your/alsa.conf:/usr/share/alsa/alsa.conf ... will replace just that one file in the Docker container with something on your local system.

1 Like

Thanks, I’ll play around with that.

Next question:
Does this install support a ‘hotword’ yet or do I need to do something else?

I’ve added a few settings to the Settings tab so that you can enable the wake/hot word (restart required).

A word of warning: this is using pocketsphinx for wake word detection, so it’s not terribly robust. There’s a threshold setting in the profile JSON that can be adjusted (wake.pocketsphinx.threshold), but it’s not a great solution.

My plan going forward is to create another Docker container with snowboy and Mycroft Precise, and have it use Rhasspy’s HTTP API.

which is the correct way to update? Something like this?

docker pull synesthesiam/rhasspy-server:armhf
docker stop synesthesiam/rhasspy-hassio-addon:armhf
docker rm synesthesiam/rhasspy-hassio-addon:armhf
docker run -d -p 12101:12101 \
  --restart unless-stopped \
  -e RHASSPY_PROFILES=/profiles \
  -v "$HOME/.rhasspy:/profiles" \
  -v /dev/snd:/dev/snd \
  --privileged \
  synesthesiam/rhasspy-server:armhf

am I going to lose all my custom word and sentences?

This doesn’t look correct, as it is referring to the name of the image rather than the container that is running. You need to do

docker container ls

to list all of the containers, and remove the ones you need to by id, or name.

In future, you can use -rm in the docker run command, and the container will be removed automatically when it is stopped, assuming you don’t make any changes inside it.

Before updating, I’d recommend verifying that your custom sentences and words are stored in $HOME/.rhasspy. You should find the files sentences.ini and custom_words.txt in the appropriate directory under profiles. As an extra precaution, you can copy/paste them out of the text boxes in the Sentences and Words tabs.

For managing containers/images, I’d highly recommend installing Portainer. It’s easy to restart containers as well as view logs and connect into a shell.

No module named ‘rasa_nlu’
I just saw this error

This should be quick fix. I decided to move RasaNLU outside of the Rhasspy container, but your profile must still be set to use it.

If you can get to your profile.json file (inside $HOME/.rhasspy/profiles/en if you’re using English), look for an an intent section and change the system from rasa to fuzzywuzzy

{
    ...
    "intent": {
        "system": "fuzzywuzzy",
        ...
    },
    ....
}

You’ll need to re-train your profile, and then you should be good to go.

{
“home_assistant”: {
“access_token”: “”,
“api_password”: “”,
“event_type_format”: “rhasspy_{0}”,
“url”: “http://hassio/homeassistant/”
},
“intent”: {
“fuzzywuzzy”: {
“examples_json”: “intent_examples.json”
},
“rasa”: {
“config”: “rasa_config.yml”,
“examples_markdown”: “intent_examples.md”,
“project_dir”: “rasa_projects”,
“project_name”: “default”
},
“remote”: {
“url”: “http://my-server:12101/api/text-to-intent”
},
“system”: “fuzzywuzzy”
},
“microphone”: {
“system”: “pyaudio”
},
“rhasspy”: {
“default_profile”: “en”,
“listen_on_start”: true,
“preload_profile”: true
},
“sounds”: {
“recorded”: “etc/wav/beep_lo.wav”,
“wake”: “etc/wav/beep_hi.wav”
},
“speech_to_text”: {
“g2p_model”: “g2p.fst”,
“grammars_dir”: “grammars”,
“pocketsphinx”: {
“acoustic_model”: “acoustic_model”,
“base_dictionary”: “base_dictionary.txt”,
“custom_words”: “custom_words.txt”,
“dictionary”: “dictionary.txt”,
“language_model”: “language_model.txt”,
“unknown_words”: “unknown_words.txt”
},
“remote”: {
“url”: “http://my-server:12101/api/speech-to-text”
},
“sentences_ini”: “sentences.ini”,
“sentences_text”: “sentences.txt”,
“system”: “pocketsphinx”
},
“text_to_speech”: {
“espeak”: {
“phoneme_map”: “espeak_phonemes.txt”
},
“phoneme_examples”: “phoneme_examples.txt”,
“system”: “espeak”
},
“training”: {
“balance_sentences”: true,
“regex”: {
“replace”: [
{
“-”: " "
}
],
“split”: “\s+”
},
“tokenizer”: “regex”
},
“wake”: {
“pocketsphinx”: {
“keyphrase”: “okay rhasspy”,
“threshold”: 1e-40
},
“system”: “pocketsphinx”
}
}

this is my profile.json file

I pulled the docker image this afternoon, and although everything works as before, I am getting this error periodically

rhasspy-server   | ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
rhasspy-server   | ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
rhasspy-server   | ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
rhasspy-server   | ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
rhasspy-server   | Cannot connect to server socket err = No such file or directory
rhasspy-server   | Cannot connect to server request channel
rhasspy-server   | jack server is not running or cannot be started

I’m not sure what it means, or if it is important.

It’s not a problem. PyAudio seems to try and go out to multiple backends, and those messages are its attempts. I’d like to silence them, since they end up just being noise.

1 Like

Your profile looks good. When do you get the error?

when i got the intent

OK, I’ll take a look. The next version of Rhasspy I’ll put out here will have rasa-nlu removed entirely. I’ll just have a separate Docker image with rasaNLU.

What is the cheapest microphone on usb working with this project? I saw u are recommending ps eye :stuck_out_tongue: but can u recommend something else?

Hello,

First I would like to say that this is a nice project, thanks! I’ve successfully installed Rhasspy in a Python Virtual Environment on my Raspberry Pi Zero with a Respeaker 2-Mics Pi HAT and connect it with my server for the CPU power (client/server installation).

The only problem I’ve found is the hotword detection, it’s not as accurate as I wish. Trying to play with the threshold values (best practices: keyphrase thresholds) and different hotwords gives a lot of false positives or no response at all. I’ve read that this is a known problem with the Pocketsphinx module and you’re working on it. But I’ve also read that there was an alternative in earlier releases named Snowboy, but it was incompatible with the Hass.io installation. Is this module entirely removed or are there possibilities to make this work again for environments without Hass.io (don’t have a Hass.io installation, running Home Assistant in a Docker container on a separate VM)?

Thanks!

I haven’t tried anything cheaper than the PS3 eye. It’s currently 7 USD on Amazon, which seems hard to beat for such a good microphone. Snips did a benchmarking a while back you might be interested in reading: https://medium.com/snips-ai/benchmarking-microphone-arrays-respeaker-conexant-microsemi-acuedge-matrix-creator-minidsp-950de8876fda

1 Like

Glad to hear you’ve gotten it installed and working! The issue I’m facing with Snowboy (and currently Mycroft Precise) is the fact that Hass.io is based on Alpine Linux, which uses different system libraries than other Linux distros.

Outside of Alpine, though, I have both working just fine! All that needs to be done is a little glue between this project and Rhasspy’s web interface. Once the wake word is detected, it just needs to do an HTTP POST to the /listen-for-command endpoint in Rhasspy, which will “wake” it up and have it start listening for a command. I’ll see if I can get an example working this weekend.