Google TTS - select voice types

Hi All

I have a few flows that uses Google TTS to say things in danish. It works rather well, though the voice is a bit monotenous.
I just discovered that if I select Google TTS on an android device and set the language there to danish, there are four different voices available in danish (voice I-IV).
We should be able to select the voice number for the TTS setup in HA.

Use Google Cloud TTS instead of regular Google TTS, you can select a much larger, better range of voices.

If you use the “paid” WaveNet one they sound even less robotic. The paid part is you get charged if you use over something stupid like 1 million sentences per month. I’ve never paid a cent.

3 Likes

I’ll try, thanks for the pointer!

Hi @callifo

I’ve tried it now, but I don’t hear any output, is it a current problem?
I call the service tts.google_cloud_say

But I get a message that “TypeError: ‘’ not a Frame instance”
Looks like something is generally off with the tts cloud service

Yeah, sorry there is a bug at the moment.

It was fixed in ~0.115.5 and then broken again in 0.116

You can fix it if you edit the init.py in the python packages
/homeassistant/components/tts/init.py

Need to make it look like this from ~ line 471.

                if isinstance(tts_file, ID3FileType):
                    tts_file["artist"] = ID3Text(encoding=3, text=artist)
                    tts_file["album"] = ID3Text(encoding=3, text=album)
                    tts_file["title"] = ID3Text(encoding=3, text=message)
                else:
                    tts_file["artist"] = ID3Text(encoding=3, text=artist)
                    tts_file["album"] = ID3Text(encoding=3, text=album)
                    tts_file["title"] = ID3Text(encoding=3, text=message)

Otherwise it should be fixed again hopefully.

Hello!

callifo’s post helped- tts engine google coud say works as it was.
Just a little addition for those who will try to fix it this way:
the magical file is located in homeassistant container, path is
/usr/src/homeassistant/homeassistant/components/tts/init.py

@callifo thanks for the fix!

With the 0.116.4 I can get it to say something, but it doesn’t seem to use the voice settings when I try to call it from developer tools