Local TTS options inside Docker

Hi All,

I recently re-built my setup and moved to hosting all my HA related stuff in Docker. This has mostly been great, though I’m still ironing out a few issues. One of these is that my TTS announcements no longer work due to PicoTTS not being available in the Docker image.

As I see it there are a couple of options to fix this:

  1. Build a custom HASS image based on the official one, but including PicoTTS
  2. Install another local TTS option (ideally via Docker), such as MaryTTS that would be available over the network

I’m not all that enthused about option 1 due to the need to re-build the image for every new HASS release. Option 2 just adds another thing to maintain.

Has anyone got any other ideas? Has anyone found another way to get PicoTTS working inside the Docker container?

(Note: I’m not at all interested in non-local i.e. cloud based TTS, hence why it’s not included in the list. Please don’t suggest this as an alternative :slight_smile:).

Thanks in advance.

1 Like

I use a marytts container. I’m not sure what you mean by ‘another thing to maintain’ but it’s just a few lines in my docker-compose and forget about it.

I meant another thing to keep updated and monitor that it’s working.

Which marytts container are you using? I didn’t find an official one in my searches.

I’m using the silversniper/marytts container, my docker-compose…

link removed

Then connect homeassistant to it…

tts:
  platform: marytts
  language: 'en-GB'
  host: !secret host_ip

And then that’s it really.

As for maintenance, I upgrade everything all at the same time using a bash script, haven’t had a single issue with MaryTTS since I started using it.

The bash script is here…

link removed

Upgrades the system, upgrades all the docker containers, restarts them all and cleans up. I do that pretty much every time homeassistant is updated.

Hope this helps.

Yes, that does help, thank you. Good to hear that marytts is pretty reliable. I think I’ll give that a try.

Nice work with the bash script, not sure why I didn’t think of that. Too busy trying to make it ‘fully’ automated I guess!

1 Like

hi, I’ve serched for you container but it seems that no longer exist. Can you tell me where to find it?

https://hub.docker.com/r/sliversniper/marytts

1 Like

Thank you! but there’s no documentation. How can I add more voices? Can you give me some more hint please?

You can check out my post on how I set it up:

https://webworxshop.com/my-road-to-docker-part-2-my-home-automation-stack

Hope this helps!

Thank you! I will try to follow your instructions!

OK I installed it and can use it with the web page.

But can’t test it with HA.

I call service “tts.marytts_say” with this service data

{“entity_id”: “media_player.corridoio”, “message”:“testing one, two, three”}

But I receive error 500

Here’s my config for Marytts.

 - platform: marytts
   host: 192.168.2.100

Any hint?

Have a look at the logs from your marytts container with docker logs <container name>. Post them here if you have trouble working it out from that.

I have a very silly question.

How to “use” marytts in Home Assistant?

I mean, by following robconnolly’s detailed instruction, I managed to spin up the marytts docker. It kind of worked because I can log onto 192.168.1.8:59125 and there is a web page which I can press test button to test things out.

when I tried to actually use it in home assistant, I am a bit stuck.

I have an Alexa speaker, but i haven’t set up my HA for the Internet yet, and the whole point of using marytts is to cut the Internet dependency, no?

I have an old Sonos speaker which no one is using, ideally that is something I can use. But apparently the default lovelace widget is not working. i.e I can input a text, but nothing came out of it. but when i look at the config/tts directory, the wav_file is there.

Yes, I integrated marytts to the tts component to the configuration.yaml file. there isn’t much to it and I don’t think I made any mistake:

tts:
  - platform: marytts
    language: en_US
    host: 192.168.1.8
    port: 59125
    voice: 'cmu-slt-hsmm'

Any pointers will be much appreciated. thanks

The MaryTTS thing appears to be broken. I was previously using it with the browser_mod extension which created media players for connected browsers, but a change a few versions back broke it.

See https://github.com/home-assistant/core/issues/32142 and https://github.com/home-assistant/core/issues/31854 as open issues.

2 Likes

@kngharv I opened the GitHub issue 32142 linked above, and had started a forum thread here. There are a couple of ideas in that thread for ways to get around the MaryTTS issue, by using PicoTTS or editing a Python file. I can’t edit the Python file because I’m using HA Supervised. I’m hoping the MaryTTS issue gets fixed sooner or later.

Thanks for the pointer to that forum thread!

Thanks.

I actually looked at PicoTTS first before I wonder to MaryTTS.

PicoTTS require native libraries. Since I am using docker and using the official docker image, the only hack I can do is to create a new docker image with built-in PicoTTS in it. It is not hard to do, just that it is not sustainable in the long run.

Thanks for your answer. I guess I just have to wait, while may be try to build a new image myself. I am new to docker thing and it will take me a bit longer to figure it out.

Harv

I was able to make marytts work with two one line changes to the tts component and the marytts component. I wonder if both of these can be copied out as custom_components and modified to override the current versions? I left some notes in that first github issue I referenced a couple of comments back.

1 Like

Dear all:

I just created a home-assistant docker image with picotts built in in a x86_64 platform.

I simply pull the latest STABLE version of home assistant image (version 0.108.1) from docker hub, and added ONE SINGLE LINE:

apk add picotts --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing

I didn’t change anything else.

I use the default sonos widget on the default UI, and the TTS worked.

If you guys happened to use stable version of home assistant image on a x86-64bit platform, you are welcome to download the image and give it a try:

docker pull kngharv/home-assistant:picotts

It is not a long term solution. I am looking for a way to file a feature enhancement request so this change can make into the trunk.

Harv

I have filed a formal feature request to bake picotts native library into the home assistant docker image itself so all we have to do is add picotts into the configuration.yaml file and do nothing else.

By having such library built-in, home assistant will have a text-to-speech feature that doesn’t require any cloud services.

Since picotts is relatively small, mature, and already being ported to various different types of computers, it is relatively easy for the developer to do this.

If you want a off-line text-to-speech feature baked into home-assistant, please go to the website and vote for such feature to get developers’ attention:

Thanks in advance

Harv

2 Likes