nimroddolev / chime_tts

A custom Home Assistant integration to play combined audio files before and/or after text-to-speech (TTS) messages
https://nimroddolev.github.io/chime_tts/
MIT License
184 stars 13 forks source link

Piper voice support #175

Open MJHeijster opened 2 months ago

MJHeijster commented 2 months ago

Checklist

Is your feature request related to a problem? Please describe.

Piper has support for many voices. One of them is en_US-hfc_female-medium. I want to be able to set in the chime_tts.say service which voice it should use.

Describe the solution you'd like

Pass voice parameter to Piper in a way piper understands.

Describe alternatives you've considered

None seem to come to mind outside of using Chime TTS.

Additional context

I use the lscr.io/linuxserver/piper docker image outside of my Home Assistant because it is more powerful, but it has less uptime. Setting the default piper voice doesn't seem to trigger said voice when called from Chime TTS. When I trigger the voice from a voice assistant in home assistant, it works, so the voice is supported.

I might be missing something, but as far as I can tell, I can't pass the voice to piper with Chime.

dbullendsl commented 2 months ago

I'm running Chime_TTS using Piper voices and find that it works just fine. I can't duplicate the configuration you have for the installation of Piper - instead I have Piper installed on the HA mini intel PC that runs the HA Core.

At the bottom of the list of parameters for Chime_TTS: Say there is a Voice parameter, check it and put in the voice name you want to use in the field. Works just fine.

service: chime_tts.say
data:
  message: This is a test
  tts_platform: tts.piper
  volume_level: 0.3
  voice: en_US-hfc_female-medium
target:
  entity_id: media_player.sonos_beam
MJHeijster commented 2 months ago

Hmm odd, looks like this is an issue specific between the docker image and Chime.

In my case tts.piper is the home assistant add-on, tts.piper2 is the one on my nas with the docker image.

service: chime_tts.say
data:
  message: This is a test 
  tts_platform: tts.piper
  volume_level: 0.3 
  voice: en_US-hfc_female-medium
target:
  entity_id: media_player.living_room_echo

works

But

service: chime_tts.say
data:
  message: This is a test 
  tts_platform: tts.piper2
  volume_level: 0.3 
  voice: en_US-hfc_female-medium
target:
  entity_id: media_player.living_room_echo

immediately returns when I press Call Service. Most notable log: - Error calling tts.media_source.generate_media_source_id: Invalid options found: ['voice']

MJHeijster commented 2 months ago

Hmm the weird thing is that I do get the voice I set in the docker container config for piper if I call tts.speak directly.

service: tts.speak
data:
  message: this is a test
  media_player_entity_id: media_player.living_room_echo
target:
  entity_id: tts.piper_2

When I use Chime, it uses a default voice. Not sure what's going on there.

dbullendsl commented 2 months ago

I'm not a developer, but an enthusiast as you are so Nim may want to look at the issue but to me it's not a problem with the chime_tts integration but with your implementation of Piper on your docker container.

dbullendsl commented 2 months ago

one other thought, try specifying the voice like this:

options: 'voice: en_GB-semaine-medium'

that still works, even though the Voice: selector parameter is available.

nimroddolev commented 1 week ago

Hi @MJHeijster.

As @dbullendsl wrote earlier, it looks like this might not be directly related to an issue with Chime TTS, but I might be able to assist you.

Could you please share your debug log messages for the action calls to chime_tts.say? Please make sure to please include an action call using the tts.piper tts platform, and another call with tts.piper2 as the tts platform.