Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Piper add-on custom voices cannot be selected in Settings > Addons > Piper > Configuration #3914

Open
domesticatedviking opened this issue Feb 3, 2025 · 4 comments

Comments

@domesticatedviking
Copy link

domesticatedviking commented Feb 3, 2025

Describe the issue you are experiencing

I have some custom piper models that I built with TextyMcSpeechy which I want to use with my automations in home assistant. These are stored in /share/piper and they appear correctly in Settings > Voice Assistants when I create Assistant entities. They also produce speech properly when tested under that system.

I want to be able to use these voices in my own automations, but there is no mechanism for adding them to the dropdown in Addons > Piper > Configuration > Voice, which determines the system-wide voice.

Image

I presume this is because this list is hardcoded somewhere like config.yaml which is located inside the Piper add-on's docker container, which cannot be edited from the Home Assistant OS webui.

Edit: the Wyoming integration may also be a possible culprit here as it seems to be downloading its own list of voices in voices.json from huggingface.

DEBUG:__main__:Namespace(piper='/usr/share/piper/piper', voice='en_US-lessac-medium', uri='tcp://0.0.0.0:10200', data_dir=['/data', '/share/piper'], download_dir='/data', speaker='0', noise_scale=0.667, length_scale=1.0, noise_w=0.333, auto_punctuation='.?!', samples_per_chunk=1024, max_piper_procs=1, update_voices=True, debug=True)
DEBUG:wyoming_piper.download:Downloading https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/voices.json to /data/voices.json
DEBUG:wyoming_piper.download:Loading /data/voices.json
DEBUG:wyoming_piper.process:Starting process for: en_US-lessac-medium (1/1)
DEBUG:wyoming_piper.download:Checking /data/en_US-lessac-medium.onnx
DEBUG:wyoming_piper.download:Checking /data/en_US-lessac-medium.onnx.json
DEBUG:wyoming_piper.process:Starting piper process: /usr/share/piper/piper args=['--model', '/data/en_US-lessac-medium.onnx', '--config', '/data/en_US-lessac-medium.onnx.json', '--output_dir', '/tmp/tmpmjmisltq', '--json-input', '--noise-scale', '0.667', '--length-scale', '1.0', '--noise-w', '0.333']
INFO:__main__:Ready

It would be useful if :

  1. the add-on would be made aware of models located in /share/piper on startup.
  2. the list of voice models available to the piper add-on could be governed by a config file located outside the docker container which could be edited by the user. (This list is also very long- it would be appreciated if it could be customized.)

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Home Assistant Operating System

Which add-on are you reporting an issue with?

Piper

What is the version of the add-on?

1.5.2

Steps to reproduce the issue

  1. Add custom voice model with proper file name format (eg en_US-myvoice-medium.onnx and en_US-myvoice-medium.onnx.json) to /share/piper from within the Home Assistant OS webui.
  2. Verify that the voice model appears and generates speech in Settings > Voice assistants by creating an assistant entity and using the voice test feature.
  3. Restart the Piper add-on.
  4. Go to Settings > Add-ons > Piper > Configuration > Voice dropdown menu
  5. en_US-myvoice-medium does not appear in the dropdown menu, therefore cannot be selected for use as the system Piper voice.

System Health information

System Information

version core-2025.1.4
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.13.1
os_name Linux
os_version 6.6.62-haos-raspi
arch aarch64
timezone America/Vancouver
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
HACS Data ok
GitHub API Calls Remaining 5000
Installed Version 2.0.5
Stage running
Available Repositories 1575
Downloaded Repositories 4
AccuWeather
can_reach_server ok
remaining_requests 15
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 14.2
update_channel stable
supervisor_version supervisor-2024.12.3
agent_version 1.6.0
docker_version 27.2.0
disk_total 56.3 GB
disk_used 7.3 GB
healthy true
supported true
host_connectivity true
supervisor_connectivity true
ntp_synchronized true
virtualization
board rpi4-64
supervisor_api ok
version_api ok
installed_addons Duck DNS (1.18.0), File editor (5.8.0), Terminal & SSH (9.16.0), Mosquitto broker (6.5.0), NGINX Home Assistant SSL proxy (3.11.1), motionEye (0.21.0), Cloudflared (5.2.7), Piper (1.5.2), FTP (5.1.1)
Dashboards
dashboards 1
resources 3
views 10
mode storage
Recorder
oldest_recorder_run August 5, 2024 at 3:06 AM
current_recorder_run February 1, 2025 at 9:25 PM
estimated_db_size 114.25 MiB
database_engine sqlite
database_version 3.47.1

Anything in the Supervisor logs that might be useful for us?

Anything in the add-on logs that might be useful for us?

Additional information

No response

@domesticatedviking
Copy link
Author

@domesticatedviking
Copy link
Author

domesticatedviking commented Feb 3, 2025

While I would still like this issue to be addressed, after some further exploring I found I was able to make use of my custom voice in my own automations by doing the following:

  1. I copied en_US-mycustomvoice-medium.onnx and en_US-mycustomvoice-medium.onnx.json to /share/piper using the FTP add-on and the Filezilla FTP client on my PC.
  2. I restarted the Piper add-on and reloaded the Piper entity in the Wyoming integration.
  3. I created a new home assistant script using the yaml below (substitute your own media player entity id and voice name for media_player.myspeakername and en_US-mycustomvoice-medium)
data:
  cache: true
  message: This is a test message
  media_player_entity_id: media_player.myspeakername
  options:
    voice: en_US-mycustomvoice-medium
target:
  entity_id: tts.piper
action: tts.speak

Calling this script successfully renders the message in the custom voice.

@domesticatedviking
Copy link
Author

To simplify the use of custom voices and make it possible to call them like any other TTS service,
I created a service script to hold the configuration for each voice which could receive messages as a template variable.

Service script: say_as_bob (note that you need to use your own media_player_entity_id and voice )

action: tts.speak
metadata: {}
data:
  cache: true
  message: "{{ message }}"
  media_player_entity_id: media_player.myspeakername
  options:
    voice: en_US-bob-medium
target:
  entity_id: tts.piper

To make Bob say whatever you like, make scripts like introduce_bob below (this yaml also works from developer tools > actions)

action: script.say_as_bob
data_template:
  message: "Pleased to meet you, I'm bob"

@domesticatedviking
Copy link
Author

For anyone who is here because they are struggling with this issue, I just wrote a fairly comprehensive guide to using custom piper voices in Home Assistant OS. It can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant