Remote Voice Assist pipeline - Piper

In this post, I’d like to show you how to run Piper on a different computer, outside your Home Assistant server.

In my experiments, Piper is already quite fast when run as an add-on in my current hardware (Intel N100 4xCPU, 16Gb RAM). But still, I tried to run it in a separate computer just to learn how to do it. In this guide I will show you how to run Piper natively in a Mac M1, without Docker (Docker is quite slow on Mac anyway).

In this post, I’ve included some screenshots with Spanish localization. I hope it’s easy enough to follow in other languages. Let’s get started!


Local baseline

First, I started with the Local pipeline as described in Getting started - Local - Home Assistant. However, the Voice pipeline debug shows Piper is virtually instantaneous, less than 1ms:

image

That’s hard to believe. After asking in the Discord server I found that the times in the debug UI are not correct. To actually measure it long it takes, you have to enable debug mode in the addon, and then check the addon logs. I did it from the command line to get timestamps, by running this command in the Home Assistant OS:

docker logs -t -f `docker ps -f name=addon_core_piper -q`

Ok, it takes about 2 seconds. That’s easier to believe. From now own, we’ll measure the times using the logs.

Remote setup

I want to run Piper on a remote server, specificlly a Mac M1 Max. This guide assumes you already have git and Python 3.12 installed. I tried different Python versions, but at the time of writing, only Python 3.12 worked.

Running Piper is, at the time of writting, not easy. There are a few open issues in the main repo that will need some workarounds. We have to set up two different pieces of sofware: piper and the Wyoming server.

Piper

The first issue is Piper (the C++ binary) as a different API than Piper (the Python script). And the Wyoming servers assumes the C++ binary API. To get the binary working I had to follow a few steps:

First, get the aarch64 binary from this release. This is not a release of the official repo, but a release done by thisa PR. The reason is that the aarch64 build in the official repo actually contains a x64 binary, and the PR mentioned fixed this problem.

This will get hopefully fixed once the PR is merged. Meanwhile, the binary from 2024.12.14.1-alpha2 should work. Of course, if you are using a different architecture the binary from the official release may work just ok.

wget https://github.com/dharmab/piper/releases/download/2024.12.14.1-alpha2/piper_macos_aarch64.tar.gz
tar xvfz piper_macos_aarch64.tar.gz

Second, you need to set up the libraries used by the binary. You need to get piper-phonemize, build it, and link it to the binary.

git clone https://github.com/rhasspy/piper-phonemize.git
cd piper-phonemize
make
install_name_tool -add_rpath /path/to/piper-phonemize/install/lib /path/to/piper/piper

To verify it worked, you should be able to run piper --help and get the help witout errors. At this point, you have the piper binary working.

Wyoming server

First you have to clone Wyoming Piper:

git clone https://github.com/rhasspy/wyoming-piper
cd wyoming-piper

Next, set up the Python environment:

python3.12 -m venv .venv
source .venv/bin/activate

Then, install the dependencies:

python -m ensurepip --upgrade
pip install -r requirements.txt

Start everything

Finally, you just need to start the Wyoming server and point it to your Piper binary:

script/run --debug --voice es_ES-davefx-medium --uri 'tcp://0.0.0.0:10200' --data-dir local --download-dir local --piper /path/to/piper/piper  --log-format '%(asctime)s %(levelname)s:%(name)s:%(message)s'

Be sure to change the --piper path to point to the piper binary we unpacked before. Also, feel free to change the voice to match your language. You can get a list of voices here The --log-format option is necessary to add a timestamp to each line, so can check how long it takes to generate a response.

Keep the server running.

Home Assistant configuration

Go to the Wyoming Protocol integration in Home Assistant and add a new service:

image

Enter your IP address and use 10200 as the port:

image

And that’s it! One last thing: I recommend renaming the integration. By default, it’s named piper, which is the same name as the local Piper. Having both with the same name can be confusing.

Voice configuration

The next step is to create a Voice Assistant using the remote Piper instance. Follow the tutorial in Getting started - Local - Home Assistant , specifically the section “Setup your assistant.” The only difference is that you should select the remote Piper instance.

image

Testing it

Using a similar sentence, I now get sub-second processing times:

That’s 2s running as add-on vs 200ms running in a separate server, about 60x faster!!


And that’s it! I hope you find this guide helpful.

Other posts in this collection:

2 Likes