Random TTS voice selection for automations?

Is it possible to randomise which TTS voice is used for an automation/output? Doesn’t matter which provider. I’ve tried things like:

language: >
        {% set voices = [
          "en-US-Wavenet-A",
          "en-US-Wavenet-B",
          "en-US-Wavenet-C",
          "en-US-Wavenet-D",
          "en-GB-Wavenet-A",
          "en-GB-Wavenet-B"
        ] %} {{ voices | random }}
      cache: false
    service: tts.cloud_say

but it won’t work.

Thanks

Hi ,

You have to have the right key and the right voice list per the different TTS flavors.

Specifically tts.cloud_say this one does some shenanigans on the message and picks a random voice…
Home-Assistant-Config/script2/tts_mp3_door_script.yaml at 121b652d8d73649f539d025253b2730a74995c28 · SirGoodenough/Home-Assistant-Config · GitHub.

If you want help, I have a blueprint for most of the major TTS flavors:HA_Blueprints/Scripts/tts_All_Message_Script_Blueprint.md at d1c15d75a7b5fa3042d60f7eee2d7633ea8a27a3 · SirGoodenough/HA_Blueprints · GitHub.

They work great. Fantastic work, thanks a lot.

1 Like