PicoVoice offline Voice AI engine gets free tier for up to 3 users

You may find a solution implemented at: https://github.com/LuisMalhadas/rhasspy
It uses the latest pvporcupine version ( 2.1.4), so this is an online version of rhasspy, but exclusively to check the key with picovoice.ai service.
This version doesn’t have deepspeech and includes snips as well as some minor updates of some dependencies.
You’ll have to build the docker image yourself after clonning the project.
It has only been tested on a raspberry pi 4.

@Sturi2011 thank you very much for your instructions.

For anyone interested in upgrading Porcupine to 2.x, I made a diff for Rhasspy 2.5.11 which makes the upgrade much more automated:

# How to upgrade Porcupine 1.9.x installed by Rhasspy 2.5.11 DEB to version 2.x

sudo su -

# Install Rhasspy 2.5.11 (replace "armel" with your architecture if needed)
wget https://github.com/rhasspy/rhasspy/releases/download/v2.5.11/rhasspy_armel.deb
dpkg -i rhasspy_armel.deb

# If you have Rhasspy already installed, just stop it.
systemctl stop rhasspy

# Install latest Porcupine.
apt update
apt install -y python3-pip
pip3 install pvporcupine

# Set installed Porcupine version in the variable below
porcupine_ver=2.1.4

# Porcupine is installed in /usr/local/lib/python3.?/dist-packages/pvporcupine
# Check it:
echo /usr/local/lib/python3.?/dist-packages/pvporcupine

# If you see anything other than "python3.7" in the path, change "3.7"
# in the variable below to the version you see...
pyver=3.7

# Move old Porcupine into ~/bcp-pvporcupine-1.9 and replace it with symlinks
# to the new version.
mkdir bcp-pvporcupine-1.9
mv /usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine-1.9.*.dist-info bcp-pvporcupine-1.9/
mv /usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine bcp-pvporcupine-1.9/
ln -s /usr/local/lib/python$pyver/dist-packages/pvporcupine \
  /usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine
ln -s /usr/local/lib/python$pyver/dist-packages/pvporcupine-$porcupine_ver.dist-info \
  /usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine-$porcupine_ver.dist-info

# Patch Rhasspy.
curl https://gist.githubusercontent.com/mprymek/f72474052aa39687af266f572e76675e/raw/7c107124faf7d7a21bdc101ba2f27bf0f9fb0f36/rhasspy-porcupine-v2.diff \
| patch -d / -p0

# (optional) Put your custom wake word file to .config/rhasspy/profiles/en/porcupine
#
# Configure your Porcupine access key and your custom wake word file in your
# profile.json:

# "wake": {
#     "porcupine": {
#       "keyword_path": "hey-hilly_en_raspberry-pi_v2_1_0.ppn",
#       "sensitivity": "0.6",
#       "access_key": "blahblahblahblahblahblahblahblahblahblahblahblahblahbl=="
#     },
#     "system": "porcupine"
# }

# If everything went well, you can now start Rhasspy.

systemctl start rhasspy
1 Like

The formatting here is terrible. The same code as gist:

thanks for the effort!

Hi Andreas,

does this mean you manged to get a Matrix Voice running on Debian/Raspberry OS Bullseye?
I built the drivers as described but the card doesn’t show up as a soundcard.
Am i missing something?

Hi djfil,
I’m trying to build the docker image without success. Specifically, I have a: failed to compute cache key: “/rhasspy-tts-larynx-hermes/requirements.txt” not found: not found
But I see lot of more errors so I’m not sure where is the main problem:

My steps are:

  1. Clone the repository: git clone GitHub - LuisMalhadas/rhasspy: Offline private voice assistant for many human languages
  2. Checkout the branch porcupinev2.1.4 with: git checkout porcupineV2.1.4
  3. Build the image: DOCKER_BUILDKIT=1 docker build -t rhasspy_porcupine_v2.1.4 .

I’m on a rpi4 with raspbian with Debian 11 arm64.

Do you know what I’m doing wrong? (I’m a docker newbie)

Thank you!

Don’t know exactly, I am afk for a few days.
I suspect you are missing some pre-built packages.
You should try building the master branch, following the documentation tutorial. Once that’s working, you can try changing branches and build the new version.
I’ll get back in a few days, and may try to help more.

update of the system with kernel and so on

sudo su
apt-get update
apt-get upgrade

wait to finish

reboot

check for actual kernel headers

sudo apt-get -y install raspberrypi-kernel-headers raspberrypi-kernel

should be already the newest or will installed with the above command

cd /home/pi/matrixio-kernel-modules/src/
make && make install
cp /home/pi/matrixio-kernel-modules/misc/matrixio.conf /etc/modules-load.d/

check for overlays

sudo su
nano /boot/config.txt

check for

dtoverlay=matrixio

if exit then fine otherwise add th overlay

reboot

check sound card devices with

aplay -l and arecord -l

have fun

With the actual kernel 6.1.21-v7+ the modules wont compile. Workaround se below:

sudo su
apt-get update
apt-get upgrade

wait to finish

reboot

check for actual kernel headers

sudo apt-get -y install raspberrypi-kernel-headers raspberrypi-kernel

should be already the newest or will installed with the above command

cd /home/pi/matrixio-kernel-modules/src/
nano ./matrixio-uart.c

Replace lines

static void matrixio_uart_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)

by

static void matrixio_uart_set_termios(struct uart_port *port,
struct ktermios *termios,
const struct ktermios *old)

Now the kernelmodules will compile with Kernel 6.1.21-v7+

Alternatively You can also clone from:

GitHub - Sturi2011/matrixio-kernel-modules: MATRIX HAL in kernel space

make && make install
cp /home/pi/matrixio-kernel-modules/misc/matrixio.conf /etc/modules-load.d/

check for overlays

sudo su
nano /boot/config.txt

check for

dtoverlay=matrixio

if exit then fine otherwise add th overlay

reboot

check sound card devices with

aplay -l and arecord -l

have fun

Hey i’m new to Docker maybe someone can help me. I’ve been trying to build this repo.
My steps are
cloning it…
open the folder in terminal
and then i start
sudo docker build -t ‘rhasspy_mod’ .

(im locked in at docker) im getting the error:

+] Building 1.3s (6/6) FINISHED                                                                                                                                                 
 => [internal] load build definition from Dockerfile                                                                                                                        0.1s
 => => transferring dockerfile: 13.10kB                                                                                                                                     0.0s
 => [internal] load .dockerignore                                                                                                                                           0.0s
 => => transferring context: 10.43kB                                                                                                                                        0.0s
 => CANCELED [internal] load metadata for docker.io/library/build-armv8:latest                                                                                              1.1s
 => ERROR [internal] load metadata for docker.io/library/run-armv8:latest                                                                                                   1.1s
 => [auth] library/run-armv8:pull token for registry-1.docker.io                                                                                                            0.0s
 => [auth] library/build-armv8:pull token for registry-1.docker.io                                                                                                          0.0s
------
 > [internal] load metadata for docker.io/library/run-armv8:latest:
------
Dockerfile:241
--------------------
 239 |     ARG TARGETARCH
 240 |     ARG TARGETVARIANT
 241 | >>> FROM run-$TARGETARCH$TARGETVARIANT
 242 |     ARG TARGETARCH
 243 |     ARG TARGETVARIANT
--------------------
ERROR: failed to solve: run-armv8: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed (did you mean run-armv7?)

does anyone know what im doing wrong?

From the error I would say your system is not supported, or it is giving the wrong architecture.

try passing the --platform argument that corresponds to your system…

Thank you, didnt worked. I think i will stick to my “old” docker version, till im ready for rhasspy 3.

I registered to PicoVoice and created a custom Wake Word.
The problem is, that this wakeword is working for Porcupine 3.0.

Unfortunatelly, any newer Version than Pcorcupine 2.1.4 starts with following error:

AttributeError: module 'pvporcupine' has no attribute 'porcupine'
    porcupine: typing.Optional[pvporcupine.porcupine.Porcupine] = None
  File "/usr/lib/rhasspy/rhasspy-wake-porcupine-hermes/rhasspywake_porcupine_hermes/__init__.py", line 46, in SiteInfo
    @dataclass
  File "/usr/lib/rhasspy/rhasspy-wake-porcupine-hermes/rhasspywake_porcupine_hermes/__init__.py", line 36, in <module>
    __import__(pkg_name)
  File "/usr/lib/python3.7/runpy.py", line 109, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.7/runpy.py", line 142, in _get_module_details
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.7/runpy.py", line 183, in _run_module_as_main

Hi,

replace line 46 in

/usr/lib/rhasspy/rhasspy-wake-porcupine-hermes/rhasspywake_porcupine_hermes/init.py

replace

porcupine: typing.Optional[pvporcupine.porcupine.Porcupine] = None

with

porcupine: typing.Optional[pvporcupine.Porcupine] = None

Greetings

Andreas

Hi,

this are the migration steps to pvporcupine 3.0.1

uninstall old packages/pvporcupine
sudo pip3 uninstall pvporcupine

install actual packages/pvporcupine
sudo pip3 install pvporcupine

remove old packages from rhasspy
sudo rm -r /usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine-2.1.2.dist-info
sudo rm -r /usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine

copy new porcupine
sudo cp /usr/local/lib/python3.9/dist-packages/pvporcupine-3.0.1.dist-info/ /usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine-3.0.1.dist-info/ -r
sudo cp /usr/local/lib/python3.9/dist-packages/pvporcupine/ /usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine/ -r

copy your porcupine 3.0 keyword file to the profile
sudo cp ./your_keyword.ppn /home/pi/.config/rhasspy/profiles/(your_language)/porcupine

Install german parameter modell if needed
cd /usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/pvporcupine/lib/common
sudo wget https://github.com/Picovoice/porcupine/raw/master/lib/common/porcupine_params_de.pv
sudo rm porcupine_params.pv
sudo mv ./porcupine_params_de.pv ./porcupine_params.pv

prepare the scripts for pvporcupine 3

replace line 46 in
/usr/lib/rhasspy/rhasspy-wake-porcupine-hermes/rhasspywake_porcupine_hermes/init.py
replace
porcupine: typing.Optional[pvporcupine.porcupine.Porcupine] = None
with
porcupine: typing.Optional[pvporcupine.Porcupine] = None

reboot
sudo init 6

Greetings Andreas

1 Like

Does porcupine 3 still require registration?

Hi,

yes you have to register for the liftime free tier.

Greetings Andreas